Winbind status program.
- Copyright (C) Tim Potter 2000
+ Copyright (C) Tim Potter 2000
+ Copyright (C) Andrew Bartlett 2002
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
struct winbindd_request *request,
struct winbindd_response *response);
+static char get_winbind_separator(void)
+{
+ struct winbindd_response response;
+ char winbind_separator;
+
+ ZERO_STRUCT(response);
+
+ /* Send off request */
+
+ if (winbindd_request(WINBINDD_INFO, NULL, &response) !=
+ NSS_STATUS_SUCCESS) {
+ printf("could not obtain winbind seperator!\n");
+ exit(1);
+ }
+
+ winbind_separator = response.data.info.winbind_separator;
+
+ if (!winbind_separator) {
+ printf("winbind separator was NULL!\n");
+ exit(1);
+ }
+
+ return winbind_separator;
+
+}
+
/* Copy of parse_domain_user from winbindd_util.c. Parse a string of the
form DOMAIN/user into a domain and a user */
-static BOOL parse_domain_user(const char *domuser, fstring domain, fstring user)
+static BOOL parse_wbinfo_domain_user(const char *domuser, fstring domain, fstring user)
{
- char *p = strchr(domuser,*lp_winbind_separator());
+
+ char *p = strchr(domuser,get_winbind_separator());
if (!p)
return False;
* Don't do the lookup if the name has no separator.
*/
- if (!strchr(name, *lp_winbind_separator()))
+ if (!strchr(name, get_winbind_separator()))
return False;
/* Send off request */
NSS_STATUS result;
char *p;
- /*
- * Don't do the lookup if the name has no separator.
- */
-
- if (!strchr(username, *lp_winbind_separator())) {
- printf("no domain seperator (%s) in username - failing\n", lp_winbind_separator());
- return False;
- }
-
/* Send off request */
ZERO_STRUCT(request);
fstring name_domain;
fstring pass;
char *p;
+ char sep = get_winbind_separator();
/*
* Don't do the lookup if the name has no separator.
*/
- if (!strchr(username, *lp_winbind_separator())) {
- printf("no domain seperator (%s) in username - failing\n", lp_winbind_separator());
+ if (!strchr(username, sep)) {
+ printf("no domain seperator (%c) in username - failing\n", sep);
return False;
}
fstrcpy(pass, p + 1);
}
- parse_domain_user(username, name_domain, name_user);
+ parse_wbinfo_domain_user(username, name_domain, name_user);
fstrcpy(request.data.auth_crap.user, name_user);
dyn_CONFIGFILE, strerror(errno));
exit(1);
}
-
+
load_interfaces();
/* Parse command line options */
Winbind daemon - miscellaneous other functions
- Copyright (C) Tim Potter 2000
+ Copyright (C) Tim Potter 2000
+ Copyright (C) Andrew Bartlett 2002
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
return WINBINDD_OK;
}
+
+/* List various tidbits of information */
+
+enum winbindd_result winbindd_info(struct winbindd_cli_state *state)
+{
+
+ DEBUG(3, ("[%5d]: request misc info\n", state->pid));
+
+ state->response.data.info.winbind_separator = *lp_winbind_separator();
+ fstrcpy(state->response.data.info.samba_version, VERSION);
+
+ return WINBINDD_OK;
+}
+
+/* List various tidbits of information */
+
+enum winbindd_result winbindd_interface_version(struct winbindd_cli_state *state)
+{
+
+ DEBUG(3, ("[%5d]: request interface version\n", state->pid));
+
+ state->response.data.interface_version = WINBIND_INTERFACE_VERSION;
+
+ return WINBINDD_OK;
+}
/* Socket commands */
+/* Update this when you change the interface. */
+#define WINBIND_INTERFACE_VERSION 1
+
enum winbindd_cmd {
/* Get users and groups */
WINBINDD_CHECK_MACHACC, /* Check machine account pw works */
WINBINDD_PING, /* Just tell me winbind is running */
+ WINBINDD_INFO, /* Various bit of info. Currently just tidbits */
+ WINBINDD_INTERFACE_VERSION, /* *TRY* to keep this in the same place... */
/* Placeholder for end of cmd list */
/* Fixed length return data */
union {
+ int interface_version; /* Try to ensure this is always in the same spot... */
/* getpwnam, getpwuid */
} name;
uid_t uid; /* sid_to_uid */
gid_t gid; /* sid_to_gid */
+ struct winbindd_info {
+ char winbind_separator;
+ fstring samba_version;
+ } info;
} data;
/* Variable length return data */