summaryrefslogtreecommitdiff
path: root/source3/auth
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2003-02-10 09:16:05 +0000
committerAndrew Bartlett <abartlet@samba.org>2003-02-10 09:16:05 +0000
commitec7a1994b0b937f95379a32bb135e816d407d843 (patch)
tree30af0a81755286192b014e5d137b4fbf45a9ecf8 /source3/auth
parent868d169a4084c24924a419adc46a54f721aa2efd (diff)
downloadsamba-ec7a1994b0b937f95379a32bb135e816d407d843.tar.gz
samba-ec7a1994b0b937f95379a32bb135e816d407d843.tar.bz2
samba-ec7a1994b0b937f95379a32bb135e816d407d843.zip
Some cleanups:
- Don't use pstrcpy into an allocated string - use safe_strcpy() directly instead. - Keep a copy of the 'server_info' attached to the vuid. In future use this for things like the session key, homedir and full name instead of current copies. - Try to avoid memory leak/segfault on Realloc failure - clear up #endif comments Andrew Bartlett (This used to be commit 162477bb086827950b6cb71afa9bef62c2753c2e)
Diffstat (limited to 'source3/auth')
-rw-r--r--source3/auth/auth_ntlmssp.c1
-rw-r--r--source3/auth/auth_unix.c2
-rw-r--r--source3/auth/auth_util.c12
-rw-r--r--source3/auth/pass_check.c2
4 files changed, 12 insertions, 5 deletions
diff --git a/source3/auth/auth_ntlmssp.c b/source3/auth/auth_ntlmssp.c
index 3e650a7a2a..43542b2474 100644
--- a/source3/auth/auth_ntlmssp.c
+++ b/source3/auth/auth_ntlmssp.c
@@ -125,7 +125,6 @@ NTSTATUS auth_ntlmssp_end(AUTH_NTLMSSP_STATE **auth_ntlmssp_state)
if ((*auth_ntlmssp_state)->server_info) {
free_server_info(&(*auth_ntlmssp_state)->server_info);
}
-
talloc_destroy(mem_ctx);
*auth_ntlmssp_state = NULL;
return NT_STATUS_OK;
diff --git a/source3/auth/auth_unix.c b/source3/auth/auth_unix.c
index 1251432b87..4f44767a81 100644
--- a/source3/auth/auth_unix.c
+++ b/source3/auth/auth_unix.c
@@ -106,7 +106,7 @@ static NTSTATUS check_unix_security(const struct auth_context *auth_context,
unbecome_root();
- if NT_STATUS_IS_OK(nt_status) {
+ if (NT_STATUS_IS_OK(nt_status)) {
if (pass) {
make_server_info_pw(server_info, pass);
} else {
diff --git a/source3/auth/auth_util.c b/source3/auth/auth_util.c
index 5fdfd0694a..bbe0c7cf43 100644
--- a/source3/auth/auth_util.c
+++ b/source3/auth/auth_util.c
@@ -671,14 +671,22 @@ static NTSTATUS get_user_groups_from_local_sam(const DOM_SID *user_sid,
};
n_unix_groups = groups_max();
- if ((*unix_groups = malloc( sizeof(gid_t) * groups_max() ) ) == NULL) {
+ if ((*unix_groups = malloc( sizeof(gid_t) * n_unix_groups ) ) == NULL) {
DEBUG(0, ("get_user_groups_from_local_sam: Out of memory allocating unix group list\n"));
passwd_free(&usr);
return NT_STATUS_NO_MEMORY;
}
if (sys_getgrouplist(usr->pw_name, usr->pw_gid, *unix_groups, &n_unix_groups) == -1) {
- *unix_groups = Realloc(*unix_groups, sizeof(gid_t) * n_unix_groups);
+ gid_t *groups_tmp;
+ groups_tmp = Realloc(*unix_groups, sizeof(gid_t) * n_unix_groups);
+ if (!groups_tmp) {
+ SAFE_FREE(*unix_groups);
+ passwd_free(&usr);
+ return NT_STATUS_NO_MEMORY;
+ }
+ *unix_groups = groups_tmp;
+
if (sys_getgrouplist(usr->pw_name, usr->pw_gid, *unix_groups, &n_unix_groups) == -1) {
DEBUG(0, ("get_user_groups_from_local_sam: failed to get the unix group list\n"));
SAFE_FREE(*unix_groups);
diff --git a/source3/auth/pass_check.c b/source3/auth/pass_check.c
index e1783bfd1e..88b82e3474 100644
--- a/source3/auth/pass_check.c
+++ b/source3/auth/pass_check.c
@@ -579,7 +579,7 @@ static NTSTATUS password_check(const char *password)
}
#endif /* HAVE_CRYPT */
#endif /* HAVE_BIGCRYPT && HAVE_CRYPT && USE_BOTH_CRYPT_CALLS */
-#endif /* WITH_PAM || KRB4_AUTH || KRB5_AUTH */
+#endif /* WITH_PAM */
}