r11960: add 'wbinfo --separator' to get the currently active winbind_separator.
authorGünther Deschner <gd@samba.org>
Tue, 29 Nov 2005 22:46:16 +0000 (22:46 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:05:39 +0000 (11:05 -0500)
Needed for KDM/GDM login masks.

Guenther
(This used to be commit abf761c8bf5e8cd3b0aba66abd5fd896035ea1ac)

source3/nsswitch/wbinfo.c

index 45195fb86ab8a36c17295db25adbb0eb649f1a48..aae76e442387d78e3d191809fb9d3d6c0775a020 100644 (file)
@@ -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 @@ static char winbind_separator(void)
        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 @@ static char winbind_separator(void)
 
        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 @@ static char winbind_separator(void)
        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 @@ enum {
        OPT_SEQUENCE,
        OPT_GETDCNAME,
        OPT_USERDOMGROUPS,
-       OPT_USERSIDS
+       OPT_USERSIDS,
+       OPT_SEPARATOR
 };
 
 int main(int argc, char **argv)
@@ -1004,6 +1016,7 @@ int main(int argc, char **argv)
 #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 @@ int main(int argc, char **argv)
                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;