AC_SUBST(WINBIND_NSS_EXTRA_LIBS)
AC_SUBST(NSSSONAMEVERSIONSUFFIX)
-if test $BLDSHARED = true -a x"$HAVE_WINBIND" = x"yes"; then
- NSS_MODULES="${WINBIND_NSS} ${WINBIND_WINS_NSS}"
-fi
-
AC_SUBST(SMB_KRB5_LOCATOR)
# Check the setting of --with-winbind
WINBIND_WINS_NSS=""
fi
+if test $BLDSHARED = true -a x"$HAVE_WINBIND" = x"yes"; then
+ NSS_MODULES="${WINBIND_NSS} ${WINBIND_WINS_NSS}"
+fi
+
if test x"$HAVE_WINBIND" = x"yes"; then
AC_MSG_RESULT(yes)
AC_DEFINE(WITH_WINBIND,1,[Whether to build winbind])
ret = convert_string(CH_DOS, CH_UNIX, src, src_len, dest, dest_len, True);
if (ret == (size_t)-1) {
+ ret = 0;
dest_len = 0;
}
- if (dest_len)
- dest[MIN(ret, dest_len-1)] = 0;
- else
+ if (dest_len && ret) {
+ /* Did we already process the terminating zero ? */
+ if (dest[MIN(ret-1, dest_len-1)] != 0) {
+ dest[MIN(ret, dest_len-1)] = 0;
+ }
+ } else {
dest[0] = 0;
+ }
return src_len;
}
if (src_len == (size_t)-1)
src_len = ret*2;
- if (dest_len)
- dest[MIN(ret, dest_len-1)] = 0;
- else
+ if (dest_len && ret) {
+ /* Did we already process the terminating zero ? */
+ if (dest[MIN(ret-1, dest_len-1)] != 0) {
+ dest[MIN(ret, dest_len-1)] = 0;
+ }
+ } else {
dest[0] = 0;
+ }
return src_len;
}
uid_to_sid(&owner_sid, sbuf.st_uid);
gid_to_sid(&group_sid, sbuf.st_gid);
- if (num_aces) {
+ if (afs_acl->num_aces) {
nt_ace_list = TALLOC_ARRAY(mem_ctx, SEC_ACE, afs_acl->num_aces);
if (nt_ace_list == NULL)
DEBUG(10, ("Query backends to map sids->ids\n"));
/* split list per domain */
-
- if (num_domains) {
- dom_ids = TALLOC_ZERO_ARRAY(ctx, struct id_map **, num_domains);
- IDMAP_CHECK_ALLOC(dom_ids);
- counters = TALLOC_ZERO_ARRAY(ctx, int, num_domains);
- IDMAP_CHECK_ALLOC(counters);
- } else {
- dom_ids = NULL;
- counters = NULL;
+ if (num_domains == 0) {
+ DEBUG(1, ("No domains available?\n"));
+ return NT_STATUS_UNSUCCESSFUL;
}
+ dom_ids = TALLOC_ZERO_ARRAY(ctx, struct id_map **, num_domains);
+ IDMAP_CHECK_ALLOC(dom_ids);
+ counters = TALLOC_ZERO_ARRAY(ctx, int, num_domains);
+ IDMAP_CHECK_ALLOC(counters);
+
/* partition the requests by domain */
for (i = 0; ids[i]; i++) {
map.sid = &sid;
map.xid.id = state->request.data.dual_idmapset.id;
map.xid.type = state->request.data.dual_idmapset.type;
+ map.status = ID_MAPPED;
result = idmap_set_mapping(&map);
return NT_STATUS_IS_OK(result) ? WINBINDD_OK : WINBINDD_ERROR;
DEBUG(3, ("[%5lu]: sids to unix ids\n", (unsigned long)state->pid));
+ if (state->request.extra_len == 0) {
+ DEBUG(0, ("Invalid buffer size!\n"));
+ return WINBINDD_ERROR;
+ }
+
sids = (DOM_SID *)state->request.extra_data.data;
num = state->request.extra_len / sizeof(DOM_SID);
memset(name_group, 0, sizeof(fstring));
tmp = state->request.data.groupname;
+
+ name_domain[0] = '\0';
+ name_group[0] = '\0';
parse_domain_user(tmp, name_domain, name_group);
return out.status;
/* pull out the data */
- if ( !(services = TALLOC_ARRAY( mem_ctx, ENUM_SERVICES_STATUS, out.returned )) )
- return WERR_NOMEM;
+ if (out.returned) {
+ if ( !(services = TALLOC_ARRAY( mem_ctx, ENUM_SERVICES_STATUS, out.returned )) )
+ return WERR_NOMEM;
+ } else {
+ services = NULL;
+ }
for ( i=0; i<out.returned; i++ ) {
svcctl_io_enum_services_status( "", &services[i], &out.buffer, 0 );
Allocate the RPC_DATA_BLOB memory.
********************************************************************/
-size_t create_rpc_blob(RPC_DATA_BLOB *str, size_t len)
+static void create_rpc_blob(RPC_DATA_BLOB *str, size_t len)
{
- str->buffer = (uint8 *)TALLOC_ZERO(get_talloc_ctx(), len);
- if (str->buffer == NULL)
- smb_panic("create_rpc_blob: talloc fail\n");
- return len;
+ if (len) {
+ str->buffer = (uint8 *)TALLOC_ZERO(get_talloc_ctx(), len);
+ if (str->buffer == NULL)
+ smb_panic("create_rpc_blob: talloc fail\n");
+ str->buf_len = len;
+ } else {
+ str->buffer = NULL;
+ str->buf_len = 0;
+ }
}
/*******************************************************************
ZERO_STRUCTP(str);
/* set up string lengths. */
- str->buf_len = create_rpc_blob(str, sizeof(uint32));
+ create_rpc_blob(str, sizeof(uint32));
SIVAL(str->buffer, 0, val);
}
ZERO_STRUCTP(str);
/* set up string lengths. */
- str->buf_len = create_rpc_blob(str, len*2);
- rpcstr_push(str->buffer, buf, (size_t)str->buf_len, STR_TERMINATE);
-
+ if (len) {
+ create_rpc_blob(str, len*2);
+ rpcstr_push(str->buffer, buf, (size_t)str->buf_len, STR_TERMINATE);
+ }
}
/*******************************************************************
void init_rpc_blob_hex(RPC_DATA_BLOB *str, const char *buf)
{
ZERO_STRUCTP(str);
- str->buf_len = create_rpc_blob(str, strlen(buf));
- str->buf_len = strhex_to_str((char *)str->buffer, str->buf_len, buf);
+ if (buf && *buf) {
+ create_rpc_blob(str, strlen(buf));
+ str->buf_len = strhex_to_str((char *)str->buffer, str->buf_len, buf);
+ }
}
/*******************************************************************
ZERO_STRUCTP(str);
/* max buffer size (allocated size) */
- if (buf != NULL) {
- len = create_rpc_blob(str, len);
+ if (buf != NULL && len) {
+ create_rpc_blob(str, len);
memcpy(str->buffer, buf, len);
}
str->buf_len = len;
*pp_mapped_count = 0;
*pp_ref = NULL;
*pp_names = NULL;
-
+
+ if (num_sids == 0) {
+ return NT_STATUS_OK;
+ }
+
names = TALLOC_ZERO_P(p->mem_ctx, LSA_TRANS_NAME_ENUM2);
sids = TALLOC_ARRAY(p->mem_ctx, const DOM_SID *, num_sids);
ref = TALLOC_ZERO_P(p->mem_ctx, DOM_R_REF);
return status;
}
- if (num_sids > 0) {
- names->name = TALLOC_ARRAY(names, LSA_TRANS_NAME2, num_sids);
- names->uni_name = TALLOC_ARRAY(names, UNISTR2, num_sids);
- if ((names->name == NULL) || (names->uni_name == NULL)) {
- return NT_STATUS_NO_MEMORY;
- }
+ names->name = TALLOC_ARRAY(names, LSA_TRANS_NAME2, num_sids);
+ names->uni_name = TALLOC_ARRAY(names, UNISTR2, num_sids);
+ if ((names->name == NULL) || (names->uni_name == NULL)) {
+ return NT_STATUS_NO_MEMORY;
}
for (i=0; i<MAX_REF_DOMAINS; i++) {
static void notify_fsp(files_struct *fsp, uint32 action, const char *name)
{
struct notify_change *change, *changes;
- char *name2;
+ pstring name2;
if (fsp->notify == NULL) {
/*
return;
}
- if (!(name2 = talloc_strdup(fsp->notify, name))) {
- DEBUG(0, ("talloc_strdup failed\n"));
- return;
- }
-
+ pstrcpy(name2, name);
string_replace(name2, '/', '\\');
/*
* guard against a DoS here.
*/
TALLOC_FREE(fsp->notify->changes);
- TALLOC_FREE(name2);
fsp->notify->num_changes = -1;
return;
}
fsp->notify, fsp->notify->changes,
struct notify_change, fsp->notify->num_changes+1))) {
DEBUG(0, ("talloc_realloc failed\n"));
- TALLOC_FREE(name2);
return;
}
change = &(fsp->notify->changes[fsp->notify->num_changes]);
- change->name = talloc_move(changes, &name2);
+ if (!(change->name = talloc_strdup(changes, name2))) {
+ DEBUG(0, ("talloc_strdup failed\n"));
+ return;
+ }
+
change->action = action;
fsp->notify->num_changes += 1;
* We have to send the two rename events in one reply. So hold
* the first part back.
*/
- return;
+ return;
}
/*
exit_server_cleanly("send_file_readbraw sendfile failed");
}
+ return;
}
normal_readbraw: