mirror of
https://github.com/samba-team/samba.git
synced 2025-02-02 09:47:23 +03:00
nt-quotas: vfs_get_ntquota() return NTSTATUS
Signed-off-by: Uri Simchoni <uri@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
d378c85f7a
commit
fcf6527202
@ -76,7 +76,8 @@ static uint64_t limit_blk2inodes(uint64_t in)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int vfs_get_ntquota(files_struct *fsp, enum SMB_QUOTA_TYPE qtype, struct dom_sid *psid, SMB_NTQUOTA_STRUCT *qt)
|
||||
NTSTATUS vfs_get_ntquota(files_struct *fsp, enum SMB_QUOTA_TYPE qtype,
|
||||
struct dom_sid *psid, SMB_NTQUOTA_STRUCT *qt)
|
||||
{
|
||||
int ret;
|
||||
SMB_DISK_QUOTA D;
|
||||
@ -84,8 +85,9 @@ int vfs_get_ntquota(files_struct *fsp, enum SMB_QUOTA_TYPE qtype, struct dom_sid
|
||||
|
||||
ZERO_STRUCT(D);
|
||||
|
||||
if (!fsp||!fsp->conn||!qt)
|
||||
return (-1);
|
||||
if (!fsp || !fsp->conn || !qt) {
|
||||
return NT_STATUS_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
ZERO_STRUCT(*qt);
|
||||
|
||||
@ -94,6 +96,7 @@ int vfs_get_ntquota(files_struct *fsp, enum SMB_QUOTA_TYPE qtype, struct dom_sid
|
||||
if (psid && !sid_to_uid(psid, &id.uid)) {
|
||||
DEBUG(0,("sid_to_uid: failed, SID[%s]\n",
|
||||
sid_string_dbg(psid)));
|
||||
return NT_STATUS_NO_SUCH_USER;
|
||||
}
|
||||
|
||||
ret = SMB_VFS_GET_QUOTA(fsp->conn, ".", qtype, id, &D);
|
||||
@ -102,7 +105,7 @@ int vfs_get_ntquota(files_struct *fsp, enum SMB_QUOTA_TYPE qtype, struct dom_sid
|
||||
qt->sid = *psid;
|
||||
|
||||
if (ret!=0) {
|
||||
return ret;
|
||||
return map_nt_error_from_unix(errno);
|
||||
}
|
||||
|
||||
qt->usedspace = (uint64_t)D.curblocks*D.bsize;
|
||||
@ -110,8 +113,7 @@ int vfs_get_ntquota(files_struct *fsp, enum SMB_QUOTA_TYPE qtype, struct dom_sid
|
||||
qt->hardlim = limit_unix2nt(D.hardlimit, D.bsize);
|
||||
qt->qflags = D.qflags;
|
||||
|
||||
|
||||
return 0;
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
int vfs_set_ntquota(files_struct *fsp, enum SMB_QUOTA_TYPE qtype, struct dom_sid *psid, SMB_NTQUOTA_STRUCT *qt)
|
||||
@ -181,6 +183,7 @@ int vfs_get_user_ntquota_list(files_struct *fsp, SMB_NTQUOTA_LIST **qt_list)
|
||||
SMB_NTQUOTA_STRUCT tmp_qt;
|
||||
SMB_NTQUOTA_LIST *tmp_list_ent;
|
||||
struct dom_sid sid;
|
||||
NTSTATUS status;
|
||||
|
||||
ZERO_STRUCT(tmp_qt);
|
||||
|
||||
@ -191,7 +194,9 @@ int vfs_get_user_ntquota_list(files_struct *fsp, SMB_NTQUOTA_LIST **qt_list)
|
||||
|
||||
uid_to_sid(&sid, usr->pw_uid);
|
||||
|
||||
if (vfs_get_ntquota(fsp, SMB_USER_QUOTA_TYPE, &sid, &tmp_qt)!=0) {
|
||||
status =
|
||||
vfs_get_ntquota(fsp, SMB_USER_QUOTA_TYPE, &sid, &tmp_qt);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
DEBUG(5,("no quota entry for sid[%s] path[%s]\n",
|
||||
sid_string_dbg(&sid),
|
||||
fsp->conn->connectpath));
|
||||
|
@ -2509,7 +2509,9 @@ static void call_nt_transact_get_user_quota(connection_struct *conn,
|
||||
return;
|
||||
}
|
||||
|
||||
if (vfs_get_ntquota(fsp, SMB_USER_QUOTA_TYPE, &sid, &qt)!=0) {
|
||||
nt_status = vfs_get_ntquota(fsp, SMB_USER_QUOTA_TYPE,
|
||||
&sid, &qt);
|
||||
if (!NT_STATUS_IS_OK(nt_status)) {
|
||||
ZERO_STRUCT(qt);
|
||||
/*
|
||||
* we have to return zero's in all fields
|
||||
|
@ -600,7 +600,8 @@ NTSTATUS notify_walk(struct notify_context *notify,
|
||||
|
||||
/* The following definitions come from smbd/ntquotas.c */
|
||||
|
||||
int vfs_get_ntquota(files_struct *fsp, enum SMB_QUOTA_TYPE qtype, struct dom_sid *psid, SMB_NTQUOTA_STRUCT *qt);
|
||||
NTSTATUS vfs_get_ntquota(files_struct *fsp, enum SMB_QUOTA_TYPE qtype,
|
||||
struct dom_sid *psid, SMB_NTQUOTA_STRUCT *qt);
|
||||
int vfs_set_ntquota(files_struct *fsp, enum SMB_QUOTA_TYPE qtype, struct dom_sid *psid, SMB_NTQUOTA_STRUCT *qt);
|
||||
int vfs_get_user_ntquota_list(files_struct *fsp, SMB_NTQUOTA_LIST **qt_list);
|
||||
void *init_quota_handle(TALLOC_CTX *mem_ctx);
|
||||
|
@ -3712,9 +3712,11 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned
|
||||
return NT_STATUS_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
if (vfs_get_ntquota(&fsp, SMB_USER_FS_QUOTA_TYPE, NULL, "as)!=0) {
|
||||
status = vfs_get_ntquota(&fsp, SMB_USER_FS_QUOTA_TYPE,
|
||||
NULL, "as);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
DEBUG(0,("vfs_get_ntquota() failed for service [%s]\n",lp_servicename(talloc_tos(), SNUM(conn))));
|
||||
return map_nt_error_from_unix(errno);
|
||||
return status;
|
||||
}
|
||||
|
||||
data_len = 48;
|
||||
|
Loading…
x
Reference in New Issue
Block a user