summaryrefslogtreecommitdiffstats
path: root/ipa-client/ipa-getkeytab.c
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2008-03-05 14:54:13 -0500
committerSimo Sorce <ssorce@redhat.com>2008-03-05 14:54:13 -0500
commitc2d3a9343f96506dedb1fdfbe28a6dc4f0b44919 (patch)
treeaef7291aedace5a8588fc30f8843685735c81693 /ipa-client/ipa-getkeytab.c
parent7fd656477a84b2677925ef5b379fa2e4793d4d48 (diff)
downloadfreeipa-c2d3a9343f96506dedb1fdfbe28a6dc4f0b44919.tar.gz
freeipa-c2d3a9343f96506dedb1fdfbe28a6dc4f0b44919.tar.xz
freeipa-c2d3a9343f96506dedb1fdfbe28a6dc4f0b44919.zip
Add --quiet option to ipa-getkeytab
Return message on success Avoid SASL output from being printed Make sure the man page is up to date
Diffstat (limited to 'ipa-client/ipa-getkeytab.c')
-rw-r--r--ipa-client/ipa-getkeytab.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/ipa-client/ipa-getkeytab.c b/ipa-client/ipa-getkeytab.c
index e81f305fb..8e02a4316 100644
--- a/ipa-client/ipa-getkeytab.c
+++ b/ipa-client/ipa-getkeytab.c
@@ -330,7 +330,7 @@ static int ldap_set_keytab(const char *servername,
ret = ldap_sasl_interactive_bind_s(ld,
NULL, "GSSAPI",
NULL, NULL,
- LDAP_SASL_AUTOMATIC,
+ LDAP_SASL_QUIET,
ldap_sasl_interact, princ);
if (ret != LDAP_SUCCESS) {
fprintf(stderr, "SASL Bind failed!\n");
@@ -449,11 +449,13 @@ int main(int argc, char *argv[])
static const char *principal = NULL;
static const char *keytab = NULL;
static const char *enctypes_string = NULL;
+ int quiet = 0;
struct poptOption options[] = {
{ "server", 's', POPT_ARG_STRING, &server, 0, "Contact this specific KDC Server", "Server Name" },
{ "principal", 'p', POPT_ARG_STRING, &principal, 0, "The principal to get a keytab for (ex: ftp/ftp.example.com@EXAMPLE.COM)", "Kerberos Service Principal Name" },
{ "keytab", 'k', POPT_ARG_STRING, &keytab, 0, "File were to store the keytab information", "Keytab File Name" },
{ "enctypes", 'e', POPT_ARG_STRING, &enctypes_string, 0, "Encryption types to request", "Comma separated encription types list" },
+ { "quiet", 'q', POPT_ARG_NONE, &quiet, 0, "Print as little as possible", "Output only on errors"},
{ NULL, 0, POPT_ARG_NONE, NULL, 0, NULL, NULL }
};
poptContext pc;
@@ -474,7 +476,9 @@ int main(int argc, char *argv[])
pc = poptGetContext("ipa-getkeytab", argc, (const char **)argv, options, 0);
ret = poptGetNextOpt(pc);
if (ret != -1 || !server || !principal || !keytab) {
- poptPrintUsage(pc, stderr, 0);
+ if (!quiet) {
+ poptPrintUsage(pc, stderr, 0);
+ }
exit(1);
}
@@ -560,5 +564,10 @@ int main(int argc, char *argv[])
exit (12);
}
+ if (!quiet) {
+ fprintf(stderr,
+ "Keytab successfully retrieved and stored in: %s\n",
+ keytab);
+ }
exit(0);
}