svn commit: samba r23648 - in branches: SAMBA_3_0/source/libads SAMBA_3_0/source/utils SAMBA_3_0_26/source/libads SAMBA_3_0_26/source/utils

gd at samba.org gd at samba.org
Fri Jun 29 09:01:30 GMT 2007


Author: gd
Date: 2007-06-29 09:01:29 +0000 (Fri, 29 Jun 2007)
New Revision: 23648

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=23648

Log:
Allow to list a custom krb5 keytab file with:

	net ads keytab list /path/to/krb5.keytab

Guenther

Modified:
   branches/SAMBA_3_0/source/libads/kerberos_keytab.c
   branches/SAMBA_3_0/source/utils/net_ads.c
   branches/SAMBA_3_0_26/source/libads/kerberos_keytab.c
   branches/SAMBA_3_0_26/source/utils/net_ads.c


Changeset:
Modified: branches/SAMBA_3_0/source/libads/kerberos_keytab.c
===================================================================
--- branches/SAMBA_3_0/source/libads/kerberos_keytab.c	2007-06-29 08:58:03 UTC (rev 23647)
+++ branches/SAMBA_3_0/source/libads/kerberos_keytab.c	2007-06-29 09:01:29 UTC (rev 23648)
@@ -801,7 +801,7 @@
  List system keytab.
 ***********************************************************************/
 
-int ads_keytab_list(void)
+int ads_keytab_list(const char *keytab_name)
 {
 	krb5_error_code ret = 0;
 	krb5_context context = NULL;
@@ -819,7 +819,7 @@
 		return ret;
 	}
 
-	ret = smb_krb5_open_keytab(context, NULL, False, &keytab);
+	ret = smb_krb5_open_keytab(context, keytab_name, False, &keytab);
 	if (ret) {
 		DEBUG(1,("ads_keytab_list: smb_krb5_open_keytab failed (%s)\n", error_message(ret)));
 		goto out;

Modified: branches/SAMBA_3_0/source/utils/net_ads.c
===================================================================
--- branches/SAMBA_3_0/source/utils/net_ads.c	2007-06-29 08:58:03 UTC (rev 23647)
+++ branches/SAMBA_3_0/source/utils/net_ads.c	2007-06-29 09:01:29 UTC (rev 23648)
@@ -2423,12 +2423,13 @@
 "  FLUSH     Flushes out all keytab entries\n"\
 "  HELP      Prints this help message\n"\
 "  LIST      List the keytab\n"\
-"The ADD command will take arguments, the other commands\n"\
+"The ADD and LIST command will take arguments, the other commands\n"\
 "will not take any arguments.   The arguments given to ADD\n"\
 "should be a list of principals to add.  For example, \n"\
 "   net ads keytab add srv1 srv2\n"\
 "will add principals for the services srv1 and srv2 to the\n"\
 "system's keytab.\n"\
+"The LIST command takes a keytabname.\n"\
 "\n"
 		);
 	return -1;
@@ -2479,15 +2480,21 @@
 
 static int net_ads_keytab_list(int argc, const char **argv)
 {
-	return ads_keytab_list();
+	const char *keytab = NULL;
+
+	if (argc >= 1) {
+		keytab = argv[0];
+	}
+
+	return ads_keytab_list(keytab);
 }
 
 
 int net_ads_keytab(int argc, const char **argv)
 {
 	struct functable func[] = {
+		{"ADD", net_ads_keytab_add},
 		{"CREATE", net_ads_keytab_create},
-		{"ADD", net_ads_keytab_add},
 		{"FLUSH", net_ads_keytab_flush},
 		{"HELP", net_ads_keytab_usage},
 		{"LIST", net_ads_keytab_list},

Modified: branches/SAMBA_3_0_26/source/libads/kerberos_keytab.c
===================================================================
--- branches/SAMBA_3_0_26/source/libads/kerberos_keytab.c	2007-06-29 08:58:03 UTC (rev 23647)
+++ branches/SAMBA_3_0_26/source/libads/kerberos_keytab.c	2007-06-29 09:01:29 UTC (rev 23648)
@@ -801,7 +801,7 @@
  List system keytab.
 ***********************************************************************/
 
-int ads_keytab_list(void)
+int ads_keytab_list(const char *keytab_name)
 {
 	krb5_error_code ret = 0;
 	krb5_context context = NULL;
@@ -819,7 +819,7 @@
 		return ret;
 	}
 
-	ret = smb_krb5_open_keytab(context, NULL, False, &keytab);
+	ret = smb_krb5_open_keytab(context, keytab_name, False, &keytab);
 	if (ret) {
 		DEBUG(1,("ads_keytab_list: smb_krb5_open_keytab failed (%s)\n", error_message(ret)));
 		goto out;

Modified: branches/SAMBA_3_0_26/source/utils/net_ads.c
===================================================================
--- branches/SAMBA_3_0_26/source/utils/net_ads.c	2007-06-29 08:58:03 UTC (rev 23647)
+++ branches/SAMBA_3_0_26/source/utils/net_ads.c	2007-06-29 09:01:29 UTC (rev 23648)
@@ -2423,12 +2423,13 @@
 "  FLUSH     Flushes out all keytab entries\n"\
 "  HELP      Prints this help message\n"\
 "  LIST      List the keytab\n"\
-"The ADD command will take arguments, the other commands\n"\
+"The ADD and LIST command will take arguments, the other commands\n"\
 "will not take any arguments.   The arguments given to ADD\n"\
 "should be a list of principals to add.  For example, \n"\
 "   net ads keytab add srv1 srv2\n"\
 "will add principals for the services srv1 and srv2 to the\n"\
 "system's keytab.\n"\
+"The LIST command takes a keytabname.\n"\
 "\n"
 		);
 	return -1;
@@ -2479,15 +2480,21 @@
 
 static int net_ads_keytab_list(int argc, const char **argv)
 {
-	return ads_keytab_list();
+	const char *keytab = NULL;
+
+	if (argc >= 1) {
+		keytab = argv[0];
+	}
+
+	return ads_keytab_list(keytab);
 }
 
 
 int net_ads_keytab(int argc, const char **argv)
 {
 	struct functable func[] = {
+		{"ADD", net_ads_keytab_add},
 		{"CREATE", net_ads_keytab_create},
-		{"ADD", net_ads_keytab_add},
 		{"FLUSH", net_ads_keytab_flush},
 		{"HELP", net_ads_keytab_usage},
 		{"LIST", net_ads_keytab_list},



More information about the samba-cvs mailing list