summaryrefslogtreecommitdiffstats
path: root/source/nsswitch
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2005-06-24 14:25:18 +0000
committerVolker Lendecke <vlendec@samba.org>2005-06-24 14:25:18 +0000
commitdaaea0fdae7b7d34ef7a05689879f1455f9ee664 (patch)
treed80948d62bbf39558d28d48598239968a63164ba /source/nsswitch
parent338125f7dfdc746e51a6ea7ce6be8328b9cade8c (diff)
downloadsamba-daaea0fdae7b7d34ef7a05689879f1455f9ee664.tar.gz
samba-daaea0fdae7b7d34ef7a05689879f1455f9ee664.tar.xz
samba-daaea0fdae7b7d34ef7a05689879f1455f9ee664.zip
r7877: Attempt to fix a smb_panic reported by Pavel Rochnyack.
Volker
Diffstat (limited to 'source/nsswitch')
-rw-r--r--source/nsswitch/winbindd_group.c21
-rw-r--r--source/nsswitch/winbindd_user.c23
2 files changed, 29 insertions, 15 deletions
diff --git a/source/nsswitch/winbindd_group.c b/source/nsswitch/winbindd_group.c
index 2751f06815f..65ae0bbf25c 100644
--- a/source/nsswitch/winbindd_group.c
+++ b/source/nsswitch/winbindd_group.c
@@ -375,7 +375,7 @@ void winbindd_getgrgid(struct winbindd_cli_state *state)
/* "Rewind" file pointer for group database enumeration */
-void winbindd_setgrent(struct winbindd_cli_state *state)
+static BOOL winbindd_setgrent_internal(struct winbindd_cli_state *state)
{
struct winbindd_domain *domain;
@@ -384,8 +384,7 @@ void winbindd_setgrent(struct winbindd_cli_state *state)
/* Check user has enabled this */
if (!lp_winbind_enum_groups()) {
- request_error(state);
- return;
+ return False;
}
/* Free old static data if it exists */
@@ -413,8 +412,7 @@ void winbindd_setgrent(struct winbindd_cli_state *state)
if ((domain_state = SMB_MALLOC_P(struct getent_state)) == NULL) {
DEBUG(1, ("winbindd_setgrent: malloc failed for domain_state!\n"));
- request_error(state);
- return;
+ return False;
}
ZERO_STRUCTP(domain_state);
@@ -427,7 +425,16 @@ void winbindd_setgrent(struct winbindd_cli_state *state)
}
state->getgrent_initialized = True;
- request_ok(state);
+ return True;
+}
+
+void winbindd_setgrent(struct winbindd_cli_state *state)
+{
+ if (winbindd_setgrent_internal(state)) {
+ request_ok(state);
+ } else {
+ request_error(state);
+ }
}
/* Close file pointer to ntdom group database */
@@ -592,7 +599,7 @@ void winbindd_getgrent(struct winbindd_cli_state *state)
group_list = (struct winbindd_gr *)state->response.extra_data;
if (!state->getgrent_initialized)
- winbindd_setgrent(state);
+ winbindd_setgrent_internal(state);
if (!(ent = state->getgrent_state)) {
request_error(state);
diff --git a/source/nsswitch/winbindd_user.c b/source/nsswitch/winbindd_user.c
index 55b63a81827..82ab79eb4ce 100644
--- a/source/nsswitch/winbindd_user.c
+++ b/source/nsswitch/winbindd_user.c
@@ -401,7 +401,7 @@ void winbindd_getpwuid(struct winbindd_cli_state *state)
/* Rewind file pointer for ntdom passwd database */
-void winbindd_setpwent(struct winbindd_cli_state *state)
+static BOOL winbindd_setpwent_internal(struct winbindd_cli_state *state)
{
struct winbindd_domain *domain;
@@ -410,8 +410,7 @@ void winbindd_setpwent(struct winbindd_cli_state *state)
/* Check user has enabled this */
if (!lp_winbind_enum_users()) {
- request_error(state);
- return;
+ return False;
}
/* Free old static data if it exists */
@@ -425,7 +424,7 @@ void winbindd_setpwent(struct winbindd_cli_state *state)
/* add any local users we have */
if ( (domain_state = (struct getent_state *)malloc(sizeof(struct getent_state))) == NULL )
- return WINBINDD_ERROR;
+ return False;
ZERO_STRUCTP(domain_state);
@@ -453,8 +452,7 @@ void winbindd_setpwent(struct winbindd_cli_state *state)
if ((domain_state = SMB_MALLOC_P(struct getent_state)) == NULL) {
DEBUG(0, ("malloc failed\n"));
- request_error(state);
- return;
+ return False;
}
ZERO_STRUCTP(domain_state);
@@ -467,7 +465,16 @@ void winbindd_setpwent(struct winbindd_cli_state *state)
}
state->getpwent_initialized = True;
- request_ok(state);
+ return True;
+}
+
+void winbindd_setpwent(struct winbindd_cli_state *state)
+{
+ if (winbindd_setpwent_internal(state)) {
+ request_ok(state);
+ } else {
+ request_error(state);
+ }
}
/* Close file pointer to ntdom passwd database */
@@ -603,7 +610,7 @@ void winbindd_getpwent(struct winbindd_cli_state *state)
user_list = (struct winbindd_pw *)state->response.extra_data;
if (!state->getpwent_initialized)
- winbindd_setpwent(state);
+ winbindd_setpwent_internal(state);
if (!(ent = state->getpwent_state)) {
request_error(state);