svn rev #22069: trunk/src/clients/kvno/

tsitkova@MIT.EDU tsitkova at MIT.EDU
Mon Mar 9 10:21:20 EDT 2009


http://src.mit.edu/fisheye/changelog/krb5/?cs=22069
Commit By: tsitkova
Log Message:
Introduced '-u' option to kvno to enforce KRB5_NT_UNKNOWN princ type.



Changed Files:
U   trunk/src/clients/kvno/kvno.c
Modified: trunk/src/clients/kvno/kvno.c
===================================================================
--- trunk/src/clients/kvno/kvno.c	2009-03-06 23:57:10 UTC (rev 22068)
+++ trunk/src/clients/kvno/kvno.c	2009-03-09 14:21:20 UTC (rev 22069)
@@ -39,7 +39,7 @@
 
 static void xusage()
 {
-    fprintf(stderr, "usage: %s [-C] [-c ccache] [-e etype] [-k keytab] [-S sname] service1 service2 ...\n",
+    fprintf(stderr, "usage: %s [-C] [-u] [-c ccache] [-e etype] [-k keytab] [-S sname] service1 service2 ...\n",
             prog);
     exit(1);
 }
@@ -48,7 +48,7 @@
 
 static void do_v5_kvno (int argc, char *argv[], 
                         char *ccachestr, char *etypestr, char *keytab_name,
-			char *sname, int canon);
+			char *sname, int canon, int unknown);
 
 #include <com_err.h>
 static void extended_com_err_fn (const char *, errcode_t, const char *,
@@ -59,7 +59,7 @@
     int option;
     char *etypestr = NULL, *ccachestr = NULL, *keytab_name = NULL;
     char *sname = NULL;
-    int canon = 0;
+    int canon = 0, unknown = 0;
 
 
     set_com_err_hook (extended_com_err_fn);
@@ -67,7 +67,7 @@
     prog = strrchr(argv[0], '/');
     prog = prog ? (prog + 1) : argv[0];
 
-    while ((option = getopt(argc, argv, "Cc:e:hk:qS:")) != -1) {
+    while ((option = getopt(argc, argv, "uCc:e:hk:qS:")) != -1) {
 	switch (option) {
 	case 'C':
 	    canon = 1;
@@ -89,7 +89,18 @@
 	    break;
 	case 'S':
 	    sname = optarg;
+            if (unknown == 1){ 
+                fprintf(stderr, "Options -u and -S are mutually exclusive\n");
+	        xusage();
+            }
 	    break;
+        case 'u':
+            unknown = 1;
+            if (sname){ 
+                fprintf(stderr, "Options -u and -S are mutually exclusive\n");
+	        xusage();
+            }
+            break;
 	default:
 	    xusage();
 	    break;
@@ -100,7 +111,7 @@
 	xusage();
 
 	do_v5_kvno(argc - optind, argv + optind,
-		   ccachestr, etypestr, keytab_name, sname, canon);
+		   ccachestr, etypestr, keytab_name, sname, canon, unknown);
     return 0;
 }
 
@@ -119,7 +130,7 @@
 
 static void do_v5_kvno (int count, char *names[], 
                         char * ccachestr, char *etypestr, char *keytab_name,
-			char *sname, int canon)
+			char *sname, int canon, int unknown)
 {
     krb5_error_code ret;
     int i, errors;
@@ -190,6 +201,9 @@
 	    errors++;
 	    continue;
 	}
+        if (unknown == 1) {
+            krb5_princ_type(context, in_creds.server) = KRB5_NT_UNKNOWN;
+        }
 
 	ret = krb5_unparse_name(context, in_creds.server, &princ);
 	if (ret) {




More information about the cvs-krb5 mailing list