summaryrefslogtreecommitdiff
path: root/source3/nsswitch/wbinfo.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2002-02-15 13:28:59 +0000
committerAndrew Bartlett <abartlet@samba.org>2002-02-15 13:28:59 +0000
commite91e0a83af5cc0282531d318d476618af2e78662 (patch)
treeaa7a2fb1c8065805a6e11c716f83d38c9be264ce /source3/nsswitch/wbinfo.c
parentcd38c3a71c74d2c62c0cf25a3b6e9ea460036ef6 (diff)
downloadsamba-e91e0a83af5cc0282531d318d476618af2e78662.tar.gz
samba-e91e0a83af5cc0282531d318d476618af2e78662.tar.bz2
samba-e91e0a83af5cc0282531d318d476618af2e78662.zip
Winbind cleanup.
This patch fixes the segfaults I introduced in the previous conneciton caching patch. It cleans up the connection cache a *lot* - in particular it adds significant robustness to the operation. If a the DC goes down, we no longer fail the next operation - the code checks if the connection died during one of its own operations on the socket, and restarts the conneciton as required. There is still a memory leak in here somewhere - but this code also cleans up a number of these. Also added is the abilty to sepecify the domain of the 'get around restrict anonymous' user that winbind uses. Andrew Bartlett (This used to be commit 92cbefdf2783bf9dbbb2179c1b2f7cdb802d84a9)
Diffstat (limited to 'source3/nsswitch/wbinfo.c')
-rw-r--r--source3/nsswitch/wbinfo.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/source3/nsswitch/wbinfo.c b/source3/nsswitch/wbinfo.c
index f39381e507..bc05f9cebb 100644
--- a/source3/nsswitch/wbinfo.c
+++ b/source3/nsswitch/wbinfo.c
@@ -43,14 +43,16 @@ static char get_winbind_separator(void)
if (winbindd_request(WINBINDD_INFO, NULL, &response) !=
NSS_STATUS_SUCCESS) {
printf("could not obtain winbind seperator!\n");
- exit(1);
+ /* HACK: (this module should not call lp_ funtions) */
+ return *lp_winbind_separator();
}
winbind_separator = response.data.info.winbind_separator;
if (!winbind_separator) {
printf("winbind separator was NULL!\n");
- exit(1);
+ /* HACK: (this module should not call lp_ funtions) */
+ return *lp_winbind_separator();
}
return winbind_separator;
@@ -69,7 +71,9 @@ static char *get_winbind_domain(void)
if (winbindd_request(WINBINDD_DOMAIN_NAME, NULL, &response) !=
NSS_STATUS_SUCCESS) {
printf("could not obtain winbind domain name!\n");
- exit(1);
+
+ /* HACK: (this module should not call lp_ funtions) */
+ return lp_workgroup();
}
fstrcpy(winbind_domain, response.data.domain_name);
@@ -514,10 +518,13 @@ static BOOL print_domain_groups(void)
static BOOL wbinfo_set_auth_user(char *username)
{
char *password;
+ fstring user, domain;
/* Separate into user and password */
- password = strchr(username, '%');
+ parse_wbinfo_domain_user(username, domain, user);
+
+ password = strchr(user, '%');
if (password) {
*password = 0;
@@ -528,7 +535,8 @@ static BOOL wbinfo_set_auth_user(char *username)
/* Store in secrets.tdb */
if (!secrets_store(SECRETS_AUTH_USER, username, strlen(username) + 1) ||
- !secrets_store(SECRETS_AUTH_PASSWORD, password, strlen(password) + 1)) {
+ !secrets_store(SECRETS_AUTH_DOMAIN, domain, strlen(domain) + 1) ||
+ !secrets_store(SECRETS_AUTH_PASSWORD, password, strlen(password) + 1)) {
fprintf(stderr, "error storing authenticated user info\n");
return False;
}