1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

Fix all sid_parse returns to be checked. Tidy up some checks and error

messages.

Jeremy.
This commit is contained in:
Jeremy Allison 2010-09-15 15:40:15 -07:00
parent db8cfda320
commit 447d96878a
3 changed files with 18 additions and 7 deletions

View File

@ -2145,7 +2145,9 @@ static void dump_sid(ADS_STRUCT *ads, const char *field, struct berval **values)
for (i=0; values[i]; i++) {
struct dom_sid sid;
fstring tmp;
sid_parse(values[i]->bv_val, values[i]->bv_len, &sid);
if (!sid_parse(values[i]->bv_val, values[i]->bv_len, &sid)) {
return;
}
printf("%s: %s\n", field, sid_to_fstring(tmp, &sid));
}
}

View File

@ -113,7 +113,9 @@ static bool parse_user_quota_record(const char *rdata, unsigned int rdata_count,
}
#endif /* LARGE_SMB_OFF_T */
sid_parse(rdata+40,sid_len,&qt.sid);
if (!sid_parse(rdata+40,sid_len,&qt.sid)) {
return false;
}
qt.qtype = SMB_USER_QUOTA_TYPE;

View File

@ -2572,7 +2572,10 @@ static void call_nt_transact_get_user_quota(connection_struct *conn,
break;
}
sid_parse(pdata+8,sid_len,&sid);
if (!sid_parse(pdata+8,sid_len,&sid)) {
reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
return;
}
if (vfs_get_ntquota(fsp, SMB_USER_QUOTA_TYPE, &sid, &qt)!=0) {
ZERO_STRUCT(qt);
@ -2689,7 +2692,7 @@ static void call_nt_transact_set_user_quota(connection_struct *conn,
if (data_count < 40) {
DEBUG(0,("TRANSACT_SET_USER_QUOTA: requires %d >= %d bytes data\n",data_count,40));
reply_nterror(req, NT_STATUS_INVALID_LEVEL);
reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
return;
}
@ -2701,9 +2704,9 @@ static void call_nt_transact_set_user_quota(connection_struct *conn,
/* sid len */
sid_len = IVAL(pdata,4);
if (data_count < 40+sid_len) {
if (data_count < 40+sid_len || (40+sid_len < sid_len)) {
DEBUG(0,("TRANSACT_SET_USER_QUOTA: requires %d >= %lu bytes data\n",data_count,(unsigned long)40+sid_len));
reply_nterror(req, NT_STATUS_INVALID_LEVEL);
reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
return;
}
@ -2753,7 +2756,11 @@ static void call_nt_transact_set_user_quota(connection_struct *conn,
}
#endif /* LARGE_SMB_OFF_T */
sid_parse(pdata+40,sid_len,&sid);
if (!sid_parse(pdata+40,sid_len,&sid)) {
reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
return;
}
DEBUGADD(8,("SID: %s\n", sid_string_dbg(&sid)));
/* 44 unknown bytes left... */