summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStef Walter <stefw@redhat.com>2013-04-09 22:14:30 +0200
committerStef Walter <stefw@redhat.com>2013-04-09 22:14:30 +0200
commit74ff6fe7517d4a012bae0cba55c89c2573ca95d1 (patch)
tree4cb55c6b6659ef70a1bb94d8eae70b65136923ed
parente16af692fdbb8569ebdb6e8d0f40d426fef5a236 (diff)
A bit of cleanup of adcli output
-rw-r--r--tools/computer.c2
-rw-r--r--tools/info.c16
2 files changed, 11 insertions, 7 deletions
diff --git a/tools/computer.c b/tools/computer.c
index fdcaca6..5974012 100644
--- a/tools/computer.c
+++ b/tools/computer.c
@@ -299,7 +299,7 @@ adcli_tool_computer_join (adcli_conn *conn,
res = adcli_enroll_join (enroll, flags);
if (res != ADCLI_SUCCESS) {
- errx (-res, "enroll in %s domain failed: %s",
+ errx (-res, "joining domain %s failed: %s",
adcli_conn_get_domain_name (conn),
adcli_get_last_error ());
}
diff --git a/tools/info.c b/tools/info.c
index 760c16c..473fff1 100644
--- a/tools/info.c
+++ b/tools/info.c
@@ -45,7 +45,8 @@ static adcli_tool_desc common_usages[] = {
};
static void
-print_info (adcli_disco *disco)
+print_info (adcli_disco *disco,
+ int for_host)
{
adcli_disco *other;
@@ -83,19 +84,19 @@ print_info (adcli_disco *disco)
switch (adcli_disco_usable (disco)) {
case ADCLI_DISCO_UNUSABLE:
- printf ("domain-controller-usable: no\n");
+ printf ("domain-controller-usable = no\n");
break;
case ADCLI_DISCO_MAYBE:
- printf ("domain-controller-usable: maybe\n");
+ printf ("domain-controller-usable = maybe\n");
break;
case ADCLI_DISCO_USABLE:
- printf ("domain-controller-usable: yes\n");
+ printf ("domain-controller-usable = yes\n");
break;
default:
break;
}
- if (disco->host_name) {
+ if (!for_host && disco->host_name) {
printf ("domain-controllers =");
for (other = disco; other != NULL; other = other->next) {
if (other->host_name)
@@ -118,6 +119,7 @@ adcli_tool_info (adcli_conn *unused,
const char *domain = NULL;
const char *server = NULL;
adcli_disco *disco = NULL;
+ int for_host;
int opt;
struct option options[] = {
@@ -167,17 +169,19 @@ adcli_tool_info (adcli_conn *unused,
adcli_disco_domain (domain, &disco);
if (disco == NULL)
errx (1, "couldn't discover domain: %s", domain);
+ for_host = 0;
}else if (server) {
adcli_disco_host (server, &disco);
if (disco == NULL)
errx (1, "couldn't discover domain controller: %s", server);
+ for_host = 1;
} else {
errx (2, "specify a domain to discover");
}
- print_info (disco);
+ print_info (disco, for_host);
adcli_disco_free (disco);
return 0;