summaryrefslogtreecommitdiff
path: root/source3/client
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2008-07-16 17:27:05 -0700
committerJeremy Allison <jra@samba.org>2008-07-16 17:27:05 -0700
commitcdabee2bb45f51f49a0c7148fe5b761d1c13658c (patch)
tree6037d5c80434aa5616dc5922160da9175c45870d /source3/client
parente0f3ea2cbeb61cb02be85d2b315948985bac27a8 (diff)
downloadsamba-cdabee2bb45f51f49a0c7148fe5b761d1c13658c.tar.gz
samba-cdabee2bb45f51f49a0c7148fe5b761d1c13658c.tar.bz2
samba-cdabee2bb45f51f49a0c7148fe5b761d1c13658c.zip
This patchset comprises a number of cleanups for the cifs upcall
binary. The biggest change is that it renames it from cifs.spnego to cifs.upcall since the cifs.spnego name really isn't applicable anymore. It also fixes a segfault when the program is run without any args and adds a manpage. Comments and/or suggestions appreciated. This set should apply cleanly to the 3.3 test branch. Signed-off-by: Jeff Layton <jlayton@redhat.com> Jeremy. (This used to be commit c633f10d9e78327664e6bca51f66756bcf0505a6)
Diffstat (limited to 'source3/client')
-rw-r--r--source3/client/cifs.upcall.c (renamed from source3/client/cifs.spnego.c)31
1 files changed, 20 insertions, 11 deletions
diff --git a/source3/client/cifs.spnego.c b/source3/client/cifs.upcall.c
index d10d19da96..3860f33e38 100644
--- a/source3/client/cifs.spnego.c
+++ b/source3/client/cifs.upcall.c
@@ -1,5 +1,5 @@
/*
-* CIFS SPNEGO user-space helper.
+* CIFS user-space helper.
* Copyright (C) Igor Mammedov (niallain@gmail.com) 2007
*
* Used by /sbin/request-key for handling
@@ -8,8 +8,8 @@
* You should have keyutils installed and add following line to
* /etc/request-key.conf file
-create cifs.spnego * * /usr/local/sbin/cifs.spnego [-v][-c] %k
-create cifs.resolver * * /usr/local/sbin/cifs.spnego [-v] %k
+create cifs.spnego * * /usr/local/sbin/cifs.upcall [-v][-c] %k
+create cifs.resolver * * /usr/local/sbin/cifs.upcall [-v] %k
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -30,7 +30,7 @@ create cifs.resolver * * /usr/local/sbin/cifs.spnego [-v] %k
#include "cifs_spnego.h"
const char *CIFSSPNEGO_VERSION = "1.1";
-static const char *prog = "cifs.spnego";
+static const char *prog = "cifs.upcall";
typedef enum _secType {
KRB5,
MS_KRB5
@@ -200,6 +200,13 @@ int cifs_resolver(const key_serial_t key, const char *key_descr)
return 0;
}
+void
+usage(const char *prog)
+{
+ syslog(LOG_WARNING, "Usage: %s [-c] [-v] key_serial", prog);
+ fprintf(stderr, "Usage: %s [-c] [-v] key_serial\n", prog);
+}
+
int main(const int argc, char *const argv[])
{
struct cifs_spnego_msg *keydata = NULL;
@@ -215,10 +222,6 @@ int main(const int argc, char *const argv[])
char *buf, *hostname = NULL;
openlog(prog, 0, LOG_DAEMON);
- if (argc < 1) {
- syslog(LOG_WARNING, "Usage: %s [-c] key_serial", prog);
- goto out;
- }
while ((c = getopt(argc, argv, "cv")) != -1) {
switch (c) {
@@ -227,9 +230,8 @@ int main(const int argc, char *const argv[])
break;
}
case 'v':{
- syslog(LOG_WARNING, "version: %s", CIFSSPNEGO_VERSION);
- fprintf(stderr, "version: %s", CIFSSPNEGO_VERSION);
- break;
+ printf("version: %s\n", CIFSSPNEGO_VERSION);
+ goto out;
}
default:{
syslog(LOG_WARNING, "unknow option: %c", c);
@@ -237,6 +239,13 @@ int main(const int argc, char *const argv[])
}
}
}
+
+ /* is there a key? */
+ if (argc <= optind) {
+ usage(prog);
+ goto out;
+ }
+
/* get key and keyring values */
errno = 0;
key = strtol(argv[optind], NULL, 10);