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;
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 {
};
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);
}
#endif /* HAVE_CRYPT */
#endif /* HAVE_BIGCRYPT && HAVE_CRYPT && USE_BOTH_CRYPT_CALLS */
-#endif /* WITH_PAM || KRB4_AUTH || KRB5_AUTH */
+#endif /* WITH_PAM */
}
/* read in the existing share modes if any */
dbuf = tdb_fetch(tdb, locking_key_fsp(fsp));
if (!dbuf.dptr) {
+ size_t offset;
/* we'll need to create a new record */
pstring fname;
DEBUG(10,("set_share_mode: creating entry for file %s. num_share_modes = 1\n",
fsp->fsp_name ));
- pstrcpy(p + sizeof(*data) + sizeof(share_mode_entry), fname);
+ offset = sizeof(*data) + sizeof(share_mode_entry);
+ safe_strcpy(p + offset, fname, size - offset);
fill_share_mode(p + sizeof(*data), fsp, port, op_type);
dbuf.dptr = p;
dbuf.dsize = size;
if ((http = httpConnect(cupsServer(), ippPort())) == NULL)
{
- DEBUG(0,("Unable to connect to CUPS server %s - %s\n",
+ DEBUG(3,("Unable to connect to CUPS server %s - %s\n",
cupsServer(), strerror(errno)));
return (0);
}
if ((response = cupsDoRequest(http, request, "/")) == NULL)
{
- DEBUG(0,("Unable to get printer status for %s - %s\n", name,
+ DEBUG(3,("Unable to get printer status for %s - %s\n", name,
ippErrorString(cupsLastError())));
httpClose(http);
return (0);
if (response->request.status.status_code >= IPP_OK_CONFLICT)
{
- DEBUG(0,("Unable to get printer status for %s - %s\n", name,
+ DEBUG(3,("Unable to get printer status for %s - %s\n", name,
ippErrorString(response->request.status.status_code)));
ippDelete(response);
return (0);
dirp->current = dirp->data;
}
- pstrcpy(dirp->data+used,n);
+ safe_strcpy(dirp->data+used,n, dirp->mallocsize - used - 1);
used += l;
dirp->numentries++;
}
DEBUG(0,("stat_cache_add: Out of memory !\n"));
return;
}
- pstrcpy(scp->names, orig_name);
- pstrcpy(scp->names+namelen+1, translated_path);
+ safe_strcpy(scp->names, orig_name, namelen);
+ safe_strcpy(scp->names+namelen+1, translated_path, namelen);
scp->name_len = namelen;
hash_insert(&stat_cache, (char *)scp, orig_name);
}