svn commit: samba r11960 - branches/SAMBA_3_0/source/nsswitch trunk/source/nsswitch

gd at samba.org gd at samba.org
Tue Nov 29 22:46:17 GMT 2005


Author: gd
Date: 2005-11-29 22:46:16 +0000 (Tue, 29 Nov 2005)
New Revision: 11960

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

Log:
add 'wbinfo --separator' to get the currently active winbind_separator.
Needed for KDM/GDM login masks.

Guenther

Modified:
   branches/SAMBA_3_0/source/nsswitch/wbinfo.c
   trunk/source/nsswitch/wbinfo.c


Changeset:
Modified: branches/SAMBA_3_0/source/nsswitch/wbinfo.c
===================================================================
--- branches/SAMBA_3_0/source/nsswitch/wbinfo.c	2005-11-29 13:54:51 UTC (rev 11959)
+++ branches/SAMBA_3_0/source/nsswitch/wbinfo.c	2005-11-29 22:46:16 UTC (rev 11960)
@@ -30,7 +30,7 @@
 
 extern int winbindd_fd;
 
-static char winbind_separator(void)
+static char winbind_separator_int(BOOL strict)
 {
 	struct winbindd_response response;
 	static BOOL got_sep;
@@ -46,6 +46,9 @@
 	if (winbindd_request_response(WINBINDD_INFO, NULL, &response) !=
 	    NSS_STATUS_SUCCESS) {
 		d_printf("could not obtain winbind separator!\n");
+		if (strict) {
+			return -1;
+		}
 		/* HACK: (this module should not call lp_ funtions) */
 		return *lp_winbind_separator();
 	}
@@ -55,6 +58,9 @@
 
 	if (!sep) {
 		d_printf("winbind separator was NULL!\n");
+		if (strict) {
+			return -1;
+		}
 		/* HACK: (this module should not call lp_ funtions) */
 		sep = *lp_winbind_separator();
 	}
@@ -62,6 +68,11 @@
 	return sep;
 }
 
+static char winbind_separator(void)
+{
+	return winbind_separator_int(False);
+}
+
 static const char *get_winbind_domain(void)
 {
 	struct winbindd_response response;
@@ -956,7 +967,8 @@
 	OPT_SEQUENCE,
 	OPT_GETDCNAME,
 	OPT_USERDOMGROUPS,
-	OPT_USERSIDS
+	OPT_USERSIDS,
+	OPT_SEPARATOR
 };
 
 int main(int argc, char **argv)
@@ -1004,6 +1016,7 @@
 #ifdef WITH_FAKE_KASERVER
  		{ "klog", 'k', POPT_ARG_STRING, &string_arg, 'k', "set an AFS token from winbind", "user%password" },
 #endif
+		{ "separator", 0, POPT_ARG_NONE, 0, OPT_SEPARATOR, "Get the active winbind separator", NULL },
 		POPT_COMMON_VERSION
 		POPT_TABLEEND
 	};
@@ -1197,6 +1210,10 @@
 		case OPT_GETDCNAME:
 			wbinfo_getdcname(string_arg);
 			break;
+		case OPT_SEPARATOR:
+			d_printf("%c\n", winbind_separator_int(True));
+			break;
+
 		/* generic configuration options */
 		case OPT_DOMAIN_NAME:
 			break;

Modified: trunk/source/nsswitch/wbinfo.c
===================================================================
--- trunk/source/nsswitch/wbinfo.c	2005-11-29 13:54:51 UTC (rev 11959)
+++ trunk/source/nsswitch/wbinfo.c	2005-11-29 22:46:16 UTC (rev 11960)
@@ -30,7 +30,7 @@
 
 extern int winbindd_fd;
 
-static char winbind_separator(void)
+static char winbind_separator_int(BOOL strict)
 {
 	struct winbindd_response response;
 	static BOOL got_sep;
@@ -46,6 +46,9 @@
 	if (winbindd_request_response(WINBINDD_INFO, NULL, &response) !=
 	    NSS_STATUS_SUCCESS) {
 		d_printf("could not obtain winbind separator!\n");
+		if (strict) {
+			return -1;
+		}
 		/* HACK: (this module should not call lp_ funtions) */
 		return *lp_winbind_separator();
 	}
@@ -55,6 +58,9 @@
 
 	if (!sep) {
 		d_printf("winbind separator was NULL!\n");
+		if (strict) {
+			return -1;
+		}
 		/* HACK: (this module should not call lp_ funtions) */
 		sep = *lp_winbind_separator();
 	}
@@ -62,6 +68,11 @@
 	return sep;
 }
 
+static char winbind_separator(void)
+{
+	return winbind_separator_int(False);
+}
+
 static const char *get_winbind_domain(void)
 {
 	struct winbindd_response response;
@@ -1009,7 +1020,8 @@
 	OPT_USERDOMGROUPS,
 	OPT_ALIASMEM,
 	OPT_GROUPMEM,
-	OPT_USERSIDS
+	OPT_USERSIDS,
+	OPT_SEPARATOR
 };
 
 int main(int argc, char **argv)
@@ -1061,6 +1073,7 @@
 #ifdef WITH_FAKE_KASERVER
  		{ "klog", 'k', POPT_ARG_STRING, &string_arg, 'k', "set an AFS token from winbind", "user%password" },
 #endif
+		{ "separator", 0, POPT_ARG_NONE, 0, OPT_SEPARATOR, "Get the active winbind separator", NULL },
 		POPT_COMMON_VERSION
 		POPT_TABLEEND
 	};
@@ -1268,6 +1281,10 @@
 		case OPT_GETDCNAME:
 			wbinfo_getdcname(string_arg);
 			break;
+		case OPT_SEPARATOR:
+			d_printf("%c\n", winbind_separator_int(True));
+			break;
+
 		/* generic configuration options */
 		case OPT_DOMAIN_NAME:
 			break;



More information about the samba-cvs mailing list