summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2009-07-14 09:47:46 +0200
committerStefan Metzmacher <metze@samba.org>2009-07-15 11:56:17 +0200
commit9e2c50971ee309dfe2f36efa11f572e1d985d057 (patch)
treeb631243d7575af0cf64cdd778943a7e5b878c9fd
parentfafe2589e684e1946431722c8845d0dadd9ab525 (diff)
downloadsamba-9e2c50971ee309dfe2f36efa11f572e1d985d057.tar.gz
samba-9e2c50971ee309dfe2f36efa11f572e1d985d057.tar.bz2
samba-9e2c50971ee309dfe2f36efa11f572e1d985d057.zip
s3:smbd: check quota access against sec_initial_uid() instead of 0
And return an NTSTATUS mapped from errno. Instead of hardcoded values. metze
-rw-r--r--source3/smbd/trans2.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index a862c1466f..d1f2e7ff18 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -2952,17 +2952,17 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned
fsp.fnum = -1;
/* access check */
- if (conn->server_info->utok.uid != 0) {
+ if (conn->server_info->utok.uid != sec_initial_uid()) {
DEBUG(0,("set_user_quota: access_denied "
"service [%s] user [%s]\n",
lp_servicename(SNUM(conn)),
conn->server_info->unix_name));
- return NT_STATUS_DOS(ERRDOS, ERRnoaccess);
+ return NT_STATUS_ACCESS_DENIED;
}
if (vfs_get_ntquota(&fsp, SMB_USER_FS_QUOTA_TYPE, NULL, &quotas)!=0) {
DEBUG(0,("vfs_get_ntquota() failed for service [%s]\n",lp_servicename(SNUM(conn))));
- return NT_STATUS_DOS(ERRSRV, ERRerror);
+ return map_nt_error_from_unix(errno);
}
data_len = 48;
@@ -3446,12 +3446,12 @@ cap_low = 0x%x, cap_high = 0x%x\n",
ZERO_STRUCT(quotas);
/* access check */
- if ((conn->server_info->utok.uid != 0)
+ if ((conn->server_info->utok.uid != sec_initial_uid())
||!CAN_WRITE(conn)) {
DEBUG(0,("set_user_quota: access_denied service [%s] user [%s]\n",
lp_servicename(SNUM(conn)),
conn->server_info->unix_name));
- reply_doserror(req, ERRSRV, ERRaccess);
+ reply_nterror(req, NT_STATUS_ACCESS_DENIED);
return;
}
@@ -3520,7 +3520,7 @@ cap_low = 0x%x, cap_high = 0x%x\n",
/* now set the quotas */
if (vfs_set_ntquota(fsp, SMB_USER_FS_QUOTA_TYPE, NULL, &quotas)!=0) {
DEBUG(0,("vfs_set_ntquota() failed for service [%s]\n",lp_servicename(SNUM(conn))));
- reply_doserror(req, ERRSRV, ERRerror);
+ reply_nterror(req, map_nt_error_from_unix(errno));
return;
}