summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-03-05 02:12:00 +0000
committerJeremy Allison <jra@samba.org>2002-03-05 02:12:00 +0000
commitaa785249438587f32e129972c82096839f7ed798 (patch)
treed3af992e8dcc3bb354a55ec2317efdecf68c8a2f
parent5d1db25abd340c2c689f913788911b3a2f411b38 (diff)
downloadsamba-aa785249438587f32e129972c82096839f7ed798.tar.gz
samba-aa785249438587f32e129972c82096839f7ed798.tar.bz2
samba-aa785249438587f32e129972c82096839f7ed798.zip
Fix the NTSTATUS -> WERROR for srvsvc pipe.
Jeremy. (This used to be commit 2b85d3570c2b149049482c3878c50cf8f5bfca61)
-rw-r--r--source3/include/doserr.h1
-rw-r--r--source3/include/rpc_srvsvc.h33
-rw-r--r--source3/rpc_parse/parse_srv.c74
-rw-r--r--source3/rpc_server/srv_srvsvc_nt.c265
4 files changed, 184 insertions, 189 deletions
diff --git a/source3/include/doserr.h b/source3/include/doserr.h
index 5633f837a8..498c3a5d2b 100644
--- a/source3/include/doserr.h
+++ b/source3/include/doserr.h
@@ -162,6 +162,7 @@
#define WERR_NOMEM W_ERROR(8)
#define WERR_INVALID_NAME W_ERROR(123)
#define WERR_UNKNOWN_LEVEL W_ERROR(124)
+#define WERR_OBJECT_PATH_INVALID W_ERROR(161)
#define WERR_NO_MORE_ITEMS W_ERROR(259)
#define WERR_MORE_DATA W_ERROR(234)
#define WERR_UNKNOWN_PRINTER_DRIVER W_ERROR(1797)
diff --git a/source3/include/rpc_srvsvc.h b/source3/include/rpc_srvsvc.h
index 10dbc102e0..c511763232 100644
--- a/source3/include/rpc_srvsvc.h
+++ b/source3/include/rpc_srvsvc.h
@@ -1,5 +1,6 @@
/*
- Unix SMB/CIFS implementation.
+ Unix SMB/Netbios implementation.
+ Version 1.9.
SMB parameters and setup
Copyright (C) Andrew Tridgell 1992-1997
Copyright (C) Luke Kenneth Casson Leighton 1996-1997
@@ -66,7 +67,7 @@ typedef struct net_srv_disk_enum {
uint32 preferred_len; /* preferred maximum length (0xffff ffff) */
uint32 total_entries; /* total number of entries */
ENUM_HND enum_hnd;
- NTSTATUS status; /* return status */
+ WERROR status; /* return status */
} SRV_Q_NET_DISK_ENUM, SRV_R_NET_DISK_ENUM;
typedef struct net_name_validate {
@@ -75,7 +76,7 @@ typedef struct net_name_validate {
UNISTR2 uni_name; /*name to validate*/
uint32 type;
uint32 flags;
- NTSTATUS status;
+ WERROR status;
} SRV_Q_NET_NAME_VALIDATE, SRV_R_NET_NAME_VALIDATE;
/* SESS_INFO_0 (pointers to level 0 session info strings) */
@@ -184,7 +185,7 @@ typedef struct r_net_sess_enum_info
uint32 total_entries; /* total number of entries */
ENUM_HND enum_hnd;
- NTSTATUS status; /* return status */
+ WERROR status; /* return status */
} SRV_R_NET_SESS_ENUM;
@@ -287,7 +288,7 @@ typedef struct r_net_conn_enum_info
uint32 total_entries; /* total number of entries */
ENUM_HND enum_hnd;
- NTSTATUS status; /* return status */
+ WERROR status; /* return status */
} SRV_R_NET_CONN_ENUM;
@@ -443,7 +444,7 @@ typedef struct r_net_share_enum_info
uint32 total_entries; /* total number of entries */
ENUM_HND enum_hnd;
- NTSTATUS status; /* return status */
+ WERROR status; /* return status */
} SRV_R_NET_SHARE_ENUM;
@@ -479,7 +480,7 @@ typedef struct srv_share_info {
typedef struct r_net_share_get_info_info
{
SRV_SHARE_INFO info;
- NTSTATUS status;
+ WERROR status;
} SRV_R_NET_SHARE_GET_INFO;
@@ -501,7 +502,7 @@ typedef struct r_net_share_set_info
{
uint32 switch_value; /* switch value */
- NTSTATUS status; /* return status */
+ WERROR status; /* return status */
} SRV_R_NET_SHARE_SET_INFO;
@@ -522,7 +523,7 @@ typedef struct r_net_share_add
{
uint32 switch_value; /* switch value */
- NTSTATUS status; /* return status */
+ WERROR status; /* return status */
} SRV_R_NET_SHARE_ADD;
@@ -538,7 +539,7 @@ typedef struct q_net_share_del
/* SRV_R_NET_SHARE_DEL */
typedef struct r_net_share_del
{
- NTSTATUS status; /* return status */
+ WERROR status; /* return status */
} SRV_R_NET_SHARE_DEL;
@@ -621,7 +622,7 @@ typedef struct r_net_file_enum_info
uint32 total_entries; /* total number of files */
ENUM_HND enum_hnd;
- NTSTATUS status; /* return status */
+ WERROR status; /* return status */
} SRV_R_NET_FILE_ENUM;
@@ -703,7 +704,7 @@ typedef struct r_net_srv_get_info
{
SRV_INFO_CTR *ctr;
- NTSTATUS status; /* return status */
+ WERROR status; /* return status */
} SRV_R_NET_SRV_GET_INFO;
@@ -724,7 +725,7 @@ typedef struct r_net_srv_set_info
{
uint32 switch_value; /* switch value */
- NTSTATUS status; /* return status */
+ WERROR status; /* return status */
} SRV_R_NET_SRV_SET_INFO;
@@ -760,7 +761,7 @@ typedef struct r_net_remote_tod
uint32 ptr_srv_tod; /* pointer to TOD */
TIME_OF_DAY_INFO *tod;
- NTSTATUS status; /* return status */
+ WERROR status; /* return status */
} SRV_R_NET_REMOTE_TOD;
@@ -785,7 +786,7 @@ typedef struct r_net_file_query_secdesc
uint32 ptr_secdesc;
uint32 size_secdesc;
SEC_DESC *sec_desc;
- NTSTATUS status;
+ WERROR status;
} SRV_R_NET_FILE_QUERY_SECDESC;
/* SRV_Q_NET_FILE_SET_SECDESC */
@@ -806,6 +807,6 @@ typedef struct q_net_file_set_secdesc
/* SRV_R_NET_FILE_SET_SECDESC */
typedef struct r_net_file_set_secdesc
{
- NTSTATUS status;
+ WERROR status;
} SRV_R_NET_FILE_SET_SECDESC;
#endif /* _RPC_SRVSVC_H */
diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c
index c440309559..2e59389012 100644
--- a/source3/rpc_parse/parse_srv.c
+++ b/source3/rpc_parse/parse_srv.c
@@ -1,5 +1,6 @@
/*
- * Unix SMB/CIFS implementation.
+ * Unix SMB/Netbios implementation.
+ * Version 1.9.
* RPC Pipe client / server routines
* Copyright (C) Andrew Tridgell 1992-1997,
* Copyright (C) Luke Kenneth Casson Leighton 1996-1997,
@@ -118,33 +119,34 @@ void init_srv_share_info2_str(SH_INFO_2_STR *sh2,
Reads or writes a structure.
********************************************************************/
-static BOOL srv_io_share_info2_str(char *desc, SH_INFO_2_STR *sh2, prs_struct *ps, int depth)
+static BOOL srv_io_share_info2_str(char *desc, SH_INFO_2 *sh, SH_INFO_2_STR *sh2, prs_struct *ps, int depth)
{
if (sh2 == NULL)
return False;
+ if (UNMARSHALLING(ps))
+ ZERO_STRUCTP(sh2);
+
prs_debug(ps, depth, desc, "srv_io_share_info2_str");
depth++;
if(!prs_align(ps))
return False;
- if(!smb_io_unistr2("", &sh2->uni_netname, True, ps, depth))
- return False;
+ if (sh->ptr_netname)
+ if(!smb_io_unistr2("", &sh2->uni_netname, True, ps, depth))
+ return False;
- if(!prs_align(ps))
- return False;
- if(!smb_io_unistr2("", &sh2->uni_remark, True, ps, depth))
- return False;
+ if (sh->ptr_remark)
+ if(!smb_io_unistr2("", &sh2->uni_remark, True, ps, depth))
+ return False;
- if(!prs_align(ps))
- return False;
- if(!smb_io_unistr2("", &sh2->uni_path, True, ps, depth))
- return False;
+ if (sh->ptr_netname)
+ if(!smb_io_unistr2("", &sh2->uni_path, True, ps, depth))
+ return False;
- if(!prs_align(ps))
- return False;
- if(!smb_io_unistr2("", &sh2->uni_passwd, True, ps, depth))
- return False;
+ if (sh->ptr_passwd)
+ if(!smb_io_unistr2("", &sh2->uni_passwd, True, ps, depth))
+ return False;
return True;
}
@@ -494,7 +496,7 @@ static BOOL srv_io_srv_share_ctr(char *desc, SRV_SHARE_INFO_CTR *ctr, prs_struct
}
for (i = 0; i < num_entries; i++) {
- if(!srv_io_share_info2_str("", &info2[i].info_2_str, ps, depth))
+ if(!srv_io_share_info2_str("", &info2[i].info_2, &info2[i].info_2_str, ps, depth))
return False;
}
@@ -613,7 +615,7 @@ BOOL srv_io_r_net_share_enum(char *desc, SRV_R_NET_SHARE_ENUM *r_n, prs_struct *
return False;
if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
return False;
- if(!prs_ntstatus("status ", ps, depth, &r_n->status))
+ if(!prs_werror("status ", ps, depth, &r_n->status))
return False;
return True;
@@ -686,7 +688,7 @@ static BOOL srv_io_srv_share_info(char *desc, prs_struct *ps, int depth, SRV_SHA
if(!srv_io_share_info2("", &r_n->share.info2.info_2, ps, depth))
return False;
- if(!srv_io_share_info2_str("", &r_n->share.info2.info_2_str, ps, depth))
+ if(!srv_io_share_info2_str("", &r_n->share.info2.info_2, &r_n->share.info2.info_2_str, ps, depth))
return False;
break;
@@ -738,7 +740,7 @@ BOOL srv_io_r_net_share_get_info(char *desc, SRV_R_NET_SHARE_GET_INFO *r_n, prs_
if(!prs_align(ps))
return False;
- if(!prs_ntstatus("status", ps, depth, &r_n->status))
+ if(!prs_werror("status", ps, depth, &r_n->status))
return False;
return True;
@@ -799,7 +801,7 @@ BOOL srv_io_r_net_share_set_info(char *desc, SRV_R_NET_SHARE_SET_INFO *q_n, prs_
if(!prs_uint32("switch_value ", ps, depth, &q_n->switch_value))
return False;
- if(!prs_ntstatus("status ", ps, depth, &q_n->status))
+ if(!prs_werror("status ", ps, depth, &q_n->status))
return False;
return True;
@@ -857,7 +859,7 @@ BOOL srv_io_r_net_share_add(char *desc, SRV_R_NET_SHARE_ADD *q_n, prs_struct *ps
if(!prs_uint32("switch_value ", ps, depth, &q_n->switch_value))
return False;
- if(!prs_ntstatus("status ", ps, depth, &q_n->status))
+ if(!prs_werror("status ", ps, depth, &q_n->status))
return False;
return True;
@@ -904,7 +906,7 @@ BOOL srv_io_r_net_share_del(char *desc, SRV_R_NET_SHARE_DEL *q_n, prs_struct *ps
if(!prs_align(ps))
return False;
- if(!prs_ntstatus("status ", ps, depth, &q_n->status))
+ if(!prs_werror("status ", ps, depth, &q_n->status))
return False;
return True;
@@ -1307,7 +1309,7 @@ BOOL srv_io_r_net_sess_enum(char *desc, SRV_R_NET_SESS_ENUM *r_n, prs_struct *ps
return False;
if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
return False;
- if(!prs_ntstatus("status ", ps, depth, &r_n->status))
+ if(!prs_werror("status ", ps, depth, &r_n->status))
return False;
return True;
@@ -1672,7 +1674,7 @@ BOOL srv_io_r_net_conn_enum(char *desc, SRV_R_NET_CONN_ENUM *r_n, prs_struct *p
return False;
if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
return False;
- if(!prs_ntstatus("status ", ps, depth, &r_n->status))
+ if(!prs_werror("status ", ps, depth, &r_n->status))
return False;
return True;
@@ -1950,7 +1952,7 @@ BOOL srv_io_r_net_file_enum(char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_struct *ps
return False;
if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
return False;
- if(!prs_ntstatus("status ", ps, depth, &r_n->status))
+ if(!prs_werror("status ", ps, depth, &r_n->status))
return False;
return True;
@@ -2236,13 +2238,13 @@ BOOL srv_io_q_net_srv_get_info(char *desc, SRV_Q_NET_SRV_GET_INFO *q_n, prs_stru
********************************************************************/
void init_srv_r_net_srv_get_info(SRV_R_NET_SRV_GET_INFO *srv,
- uint32 switch_value, SRV_INFO_CTR *ctr, NTSTATUS status)
+ uint32 switch_value, SRV_INFO_CTR *ctr, WERROR status)
{
DEBUG(5,("init_srv_r_net_srv_get_info\n"));
srv->ctr = ctr;
- if (NT_STATUS_IS_OK(status)) {
+ if (W_ERROR_IS_OK(status)) {
srv->ctr->switch_value = switch_value;
srv->ctr->ptr_srv_ctr = 1;
} else {
@@ -2258,7 +2260,7 @@ void init_srv_r_net_srv_get_info(SRV_R_NET_SRV_GET_INFO *srv,
********************************************************************/
void init_srv_r_net_srv_set_info(SRV_R_NET_SRV_SET_INFO *srv,
- uint32 switch_value, NTSTATUS status)
+ uint32 switch_value, WERROR status)
{
DEBUG(5,("init_srv_r_net_srv_set_info\n"));
@@ -2322,7 +2324,7 @@ BOOL srv_io_r_net_srv_get_info(char *desc, SRV_R_NET_SRV_GET_INFO *r_n, prs_stru
if(!srv_io_info_ctr("ctr", r_n->ctr, ps, depth))
return False;
- if(!prs_ntstatus("status ", ps, depth, &r_n->status))
+ if(!prs_werror("status ", ps, depth, &r_n->status))
return False;
return True;
@@ -2344,7 +2346,7 @@ BOOL srv_io_r_net_srv_set_info(char *desc, SRV_R_NET_SRV_SET_INFO *r_n,
if(!prs_uint32("switch_value ", ps, depth, &r_n->switch_value))
return False;
- if(!prs_ntstatus("status ", ps, depth, &r_n->status))
+ if(!prs_werror("status ", ps, depth, &r_n->status))
return False;
return True;
@@ -2463,7 +2465,7 @@ BOOL srv_io_r_net_remote_tod(char *desc, SRV_R_NET_REMOTE_TOD *r_n, prs_struct *
if(!srv_io_time_of_day_info("tod", r_n->tod, ps, depth))
return False;
- if(!prs_ntstatus("status ", ps, depth, &r_n->status))
+ if(!prs_werror("status ", ps, depth, &r_n->status))
return False;
return True;
@@ -2562,7 +2564,7 @@ BOOL srv_io_r_net_disk_enum(char *desc, SRV_R_NET_DISK_ENUM *r_n, prs_struct *ps
if(!smb_io_enum_hnd("enum_hnd", &r_n->enum_hnd, ps, depth))
return False;
- if(!prs_ntstatus("status", ps, depth, &r_n->status))
+ if(!prs_werror("status", ps, depth, &r_n->status))
return False;
return True;
@@ -2622,7 +2624,7 @@ BOOL srv_io_r_net_name_validate(char *desc, SRV_R_NET_NAME_VALIDATE *r_n, prs_st
if(!prs_align(ps))
return False;
- if(!prs_ntstatus("status", ps, depth, &r_n->status))
+ if(!prs_werror("status", ps, depth, &r_n->status))
return False;
return True;
@@ -2709,7 +2711,7 @@ BOOL srv_io_r_net_file_query_secdesc(char *desc, SRV_R_NET_FILE_QUERY_SECDESC *r
if(!prs_align(ps))
return False;
- if(!prs_ntstatus("status", ps, depth, &r_n->status))
+ if(!prs_werror("status", ps, depth, &r_n->status))
return False;
return True;
@@ -2787,7 +2789,7 @@ BOOL srv_io_r_net_file_set_secdesc(char *desc, SRV_R_NET_FILE_SET_SECDESC *r_n,
if(!prs_align(ps))
return False;
- if(!prs_ntstatus("status", ps, depth, &r_n->status))
+ if(!prs_werror("status", ps, depth, &r_n->status))
return False;
return True;
diff --git a/source3/rpc_server/srv_srvsvc_nt.c b/source3/rpc_server/srv_srvsvc_nt.c
index 148bcb4d1e..09f33b9a88 100644
--- a/source3/rpc_server/srv_srvsvc_nt.c
+++ b/source3/rpc_server/srv_srvsvc_nt.c
@@ -1,9 +1,7 @@
/*
- * Unix SMB/CIFS implementation.
+ * Unix SMB/Netbios implementation.
* RPC Pipe client / server routines
* Copyright (C) Andrew Tridgell 1992-1997,
- * Copyright (C) Luke Kenneth Casson Leighton 1996-1997,
- * Copyright (C) Paul Ashton 1997.
* Copyright (C) Jeremy Allison 2001.
*
* This program is free software; you can redistribute it and/or modify
@@ -173,8 +171,8 @@ static SEC_DESC *get_share_security_default( TALLOC_CTX *ctx, int snum, size_t *
se_map_generic(&def_access, &file_generic_mapping);
- init_sec_access(&sa, GENERIC_ALL_ACCESS | def_access );
- init_sec_ace(&ace, &global_sid_World, SEC_ACE_TYPE_ACCESS_ALLOWED, sa, 0);
+ init_sec_access(&sa, GENERIC_ALL_ACCESS | def_access );
+ init_sec_ace(&ace, &global_sid_World, SEC_ACE_TYPE_ACCESS_ALLOWED, sa, 0);
if ((psa = make_sec_acl(ctx, NT4_ACL_REVISION, 1, &ace)) != NULL) {
psd = make_sec_desc(ctx, SEC_DESC_REVISION, NULL, NULL, NULL, psa, psize);
@@ -204,13 +202,13 @@ static SEC_DESC *get_share_security( TALLOC_CTX *ctx, int snum, size_t *psize)
slprintf(key, sizeof(key)-1, "SECDESC/%s", lp_servicename(snum));
- if (tdb_prs_fetch(share_tdb, key, &ps, ctx)!=0 ||
- !sec_io_desc("get_share_security", &psd, &ps, 1)) {
+ if (tdb_prs_fetch(share_tdb, key, &ps, ctx)!=0 ||
+ !sec_io_desc("get_share_security", &psd, &ps, 1)) {
- DEBUG(4,("get_share_security: using default secdesc for %s\n", lp_servicename(snum) ));
+ DEBUG(4,("get_share_security: using default secdesc for %s\n", lp_servicename(snum) ));
- return get_share_security_default(ctx, snum, psize);
- }
+ return get_share_security_default(ctx, snum, psize);
+ }
if (psd)
*psize = sec_desc_size(psd);
@@ -236,27 +234,26 @@ static BOOL set_share_security(TALLOC_CTX *ctx, const char *share_name, SEC_DESC
prs_init(&ps, (uint32)sec_desc_size(psd), mem_ctx, MARSHALL);
- if (!sec_io_desc("share_security", &psd, &ps, 1)) {
- goto out;
- }
+ if (!sec_io_desc("share_security", &psd, &ps, 1))
+ goto out;
slprintf(key, sizeof(key)-1, "SECDESC/%s", share_name);
- if (tdb_prs_store(share_tdb, key, &ps)==0) {
- ret = True;
- DEBUG(5,("set_share_security: stored secdesc for %s\n", share_name ));
- } else {
- DEBUG(1,("set_share_security: Failed to store secdesc for %s\n", share_name ));
- }
-
- /* Free malloc'ed memory */
+ if (tdb_prs_store(share_tdb, key, &ps)==0) {
+ ret = True;
+ DEBUG(5,("set_share_security: stored secdesc for %s\n", share_name ));
+ } else {
+ DEBUG(1,("set_share_security: Failed to store secdesc for %s\n", share_name ));
+ }
+
+ /* Free malloc'ed memory */
out:
- prs_mem_free(&ps);
- if (mem_ctx)
- talloc_destroy(mem_ctx);
- return ret;
+ prs_mem_free(&ps);
+ if (mem_ctx)
+ talloc_destroy(mem_ctx);
+ return ret;
}
/*******************************************************************
@@ -523,9 +520,9 @@ static void init_srv_r_net_share_enum(pipes_struct *p, SRV_R_NET_SHARE_ENUM *r_n
if (init_srv_share_info_ctr(p, &r_n->ctr, info_level,
&resume_hnd, &r_n->total_entries, all)) {
- r_n->status = NT_STATUS_OK;
+ r_n->status = WERR_OK;
} else {
- r_n->status = NT_STATUS_INVALID_INFO_CLASS;
+ r_n->status = WERR_UNKNOWN_LEVEL;
}
init_enum_hnd(&r_n->enum_hnd, resume_hnd);
@@ -538,7 +535,7 @@ static void init_srv_r_net_share_enum(pipes_struct *p, SRV_R_NET_SHARE_ENUM *r_n
static void init_srv_r_net_share_get_info(pipes_struct *p, SRV_R_NET_SHARE_GET_INFO *r_n,
char *share_name, uint32 info_level)
{
- NTSTATUS status = NT_STATUS_OK;
+ WERROR status = WERR_OK;
int snum;
DEBUG(5,("init_srv_r_net_share_get_info: %d\n", __LINE__));
@@ -563,14 +560,14 @@ static void init_srv_r_net_share_get_info(pipes_struct *p, SRV_R_NET_SHARE_GET_I
break;
default:
DEBUG(5,("init_srv_net_share_get_info: unsupported switch value %d\n", info_level));
- status = NT_STATUS_INVALID_INFO_CLASS;
+ status = WERR_UNKNOWN_LEVEL;
break;
}
} else {
- status = NT_STATUS_BAD_NETWORK_NAME;
+ status = WERR_INVALID_NAME;
}
- r_n->info.ptr_share_ctr = NT_STATUS_IS_OK(status) ? 1 : 0;
+ r_n->info.ptr_share_ctr = W_ERROR_IS_OK(status) ? 1 : 0;
r_n->status = status;
}
@@ -687,10 +684,10 @@ static void init_srv_sess_info_1(SRV_SESS_INFO_1 *ss1, uint32 *snum, uint32 *sto
makes a SRV_R_NET_SESS_ENUM structure.
********************************************************************/
-static NTSTATUS init_srv_sess_info_ctr(SRV_SESS_INFO_CTR *ctr,
+static WERROR init_srv_sess_info_ctr(SRV_SESS_INFO_CTR *ctr,
int switch_value, uint32 *resume_hnd, uint32 *total_entries)
{
- NTSTATUS status = NT_STATUS_OK;
+ WERROR status = WERR_OK;
DEBUG(5,("init_srv_sess_info_ctr: %d\n", __LINE__));
ctr->switch_value = switch_value;
@@ -709,7 +706,7 @@ static NTSTATUS init_srv_sess_info_ctr(SRV_SESS_INFO_CTR *ctr,
(*resume_hnd) = 0;
(*total_entries) = 0;
ctr->ptr_sess_ctr = 0;
- status = NT_STATUS_INVALID_INFO_CLASS;
+ status = WERR_UNKNOWN_LEVEL;
break;
}
@@ -728,11 +725,11 @@ static void init_srv_r_net_sess_enum(SRV_R_NET_SESS_ENUM *r_n,
r_n->sess_level = sess_level;
if (sess_level == -1)
- r_n->status = NT_STATUS_INVALID_INFO_CLASS;
+ r_n->status = WERR_UNKNOWN_LEVEL;
else
r_n->status = init_srv_sess_info_ctr(r_n->ctr, switch_value, &resume_hnd, &r_n->total_entries);
- if (NT_STATUS_IS_ERR(r_n->status))
+ if (!W_ERROR_IS_OK(r_n->status))
resume_hnd = 0;
init_enum_hnd(&r_n->enum_hnd, resume_hnd);
@@ -843,10 +840,10 @@ static void init_srv_conn_info_1(SRV_CONN_INFO_1 *ss1, uint32 *snum, uint32 *sto
makes a SRV_R_NET_CONN_ENUM structure.
********************************************************************/
-static NTSTATUS init_srv_conn_info_ctr(SRV_CONN_INFO_CTR *ctr,
+static WERROR init_srv_conn_info_ctr(SRV_CONN_INFO_CTR *ctr,
int switch_value, uint32 *resume_hnd, uint32 *total_entries)
{
- NTSTATUS status = NT_STATUS_OK;
+ WERROR status = WERR_OK;
DEBUG(5,("init_srv_conn_info_ctr: %d\n", __LINE__));
ctr->switch_value = switch_value;
@@ -865,7 +862,7 @@ static NTSTATUS init_srv_conn_info_ctr(SRV_CONN_INFO_CTR *ctr,
(*resume_hnd = 0);
(*total_entries) = 0;
ctr->ptr_conn_ctr = 0;
- status = NT_STATUS_INVALID_INFO_CLASS;
+ status = WERR_UNKNOWN_LEVEL;
break;
}
@@ -883,11 +880,11 @@ static void init_srv_r_net_conn_enum(SRV_R_NET_CONN_ENUM *r_n,
r_n->conn_level = conn_level;
if (conn_level == -1)
- r_n->status = NT_STATUS_INVALID_INFO_CLASS;
+ r_n->status = WERR_UNKNOWN_LEVEL;
else
r_n->status = init_srv_conn_info_ctr(r_n->ctr, switch_value, &resume_hnd, &r_n->total_entries);
- if (NT_STATUS_IS_ERR(r_n->status))
+ if (!W_ERROR_IS_OK(r_n->status))
resume_hnd = 0;
init_enum_hnd(&r_n->enum_hnd, resume_hnd);
@@ -943,10 +940,10 @@ static void init_srv_file_info_3(SRV_FILE_INFO_3 *fl3, uint32 *fnum, uint32 *fto
makes a SRV_R_NET_FILE_ENUM structure.
********************************************************************/
-static NTSTATUS init_srv_file_info_ctr(SRV_FILE_INFO_CTR *ctr,
+static WERROR init_srv_file_info_ctr(SRV_FILE_INFO_CTR *ctr,
int switch_value, uint32 *resume_hnd, uint32 *total_entries)
{
- NTSTATUS status = NT_STATUS_OK;
+ WERROR status = WERR_OK;
DEBUG(5,("init_srv_file_info_ctr: %d\n", __LINE__));
ctr->switch_value = switch_value;
@@ -961,7 +958,7 @@ static NTSTATUS init_srv_file_info_ctr(SRV_FILE_INFO_CTR *ctr,
(*resume_hnd = 0);
(*total_entries) = 0;
ctr->ptr_file_ctr = 0;
- status = NT_STATUS_INVALID_INFO_CLASS;
+ status = WERR_UNKNOWN_LEVEL;
break;
}
@@ -979,11 +976,11 @@ static void init_srv_r_net_file_enum(SRV_R_NET_FILE_ENUM *r_n,
r_n->file_level = file_level;
if (file_level == 0)
- r_n->status = NT_STATUS_INVALID_INFO_CLASS;
+ r_n->status = WERR_UNKNOWN_LEVEL;
else
r_n->status = init_srv_file_info_ctr(r_n->ctr, switch_value, &resume_hnd, &(r_n->total_entries));
- if (NT_STATUS_IS_ERR(r_n->status))
+ if (!W_ERROR_IS_OK(r_n->status))
resume_hnd = 0;
init_enum_hnd(&r_n->enum_hnd, resume_hnd);
@@ -993,13 +990,13 @@ static void init_srv_r_net_file_enum(SRV_R_NET_FILE_ENUM *r_n,
net server get info
********************************************************************/
-NTSTATUS _srv_net_srv_get_info(pipes_struct *p, SRV_Q_NET_SRV_GET_INFO *q_u, SRV_R_NET_SRV_GET_INFO *r_u)
+WERROR _srv_net_srv_get_info(pipes_struct *p, SRV_Q_NET_SRV_GET_INFO *q_u, SRV_R_NET_SRV_GET_INFO *r_u)
{
- NTSTATUS status = NT_STATUS_OK;
+ WERROR status = WERR_OK;
SRV_INFO_CTR *ctr = (SRV_INFO_CTR *)talloc(p->mem_ctx, sizeof(SRV_INFO_CTR));
if (!ctr)
- return NT_STATUS_NO_MEMORY;
+ return WERR_NOMEM;
ZERO_STRUCTP(ctr);
@@ -1031,7 +1028,7 @@ NTSTATUS _srv_net_srv_get_info(pipes_struct *p, SRV_Q_NET_SRV_GET_INFO *q_u, SRV
init_srv_info_100(&ctr->srv.sv100, 500, global_myname);
break;
default:
- status = NT_STATUS_INVALID_INFO_CLASS;
+ status = WERR_UNKNOWN_LEVEL;
break;
}
@@ -1047,12 +1044,9 @@ NTSTATUS _srv_net_srv_get_info(pipes_struct *p, SRV_Q_NET_SRV_GET_INFO *q_u, SRV
net server set info
********************************************************************/
-NTSTATUS _srv_net_srv_set_info(pipes_struct *p, SRV_Q_NET_SRV_SET_INFO *q_u, SRV_R_NET_SRV_SET_INFO *r_u)
+WERROR _srv_net_srv_set_info(pipes_struct *p, SRV_Q_NET_SRV_SET_INFO *q_u, SRV_R_NET_SRV_SET_INFO *r_u)
{
- /* NT gives "Windows NT error 0xc00000022" if we return
- NT_STATUS_ACCESS_DENIED here so just pretend everything is OK. */
-
- NTSTATUS status = NT_STATUS_OK;
+ WERROR status = WERR_OK;
DEBUG(5,("srv_net_srv_set_info: %d\n", __LINE__));
@@ -1069,11 +1063,11 @@ NTSTATUS _srv_net_srv_set_info(pipes_struct *p, SRV_Q_NET_SRV_SET_INFO *q_u, SRV
net file enum
********************************************************************/
-NTSTATUS _srv_net_file_enum(pipes_struct *p, SRV_Q_NET_FILE_ENUM *q_u, SRV_R_NET_FILE_ENUM *r_u)
+WERROR _srv_net_file_enum(pipes_struct *p, SRV_Q_NET_FILE_ENUM *q_u, SRV_R_NET_FILE_ENUM *r_u)
{
r_u->ctr = (SRV_FILE_INFO_CTR *)talloc(p->mem_ctx, sizeof(SRV_FILE_INFO_CTR));
if (!r_u->ctr)
- return NT_STATUS_NO_MEMORY;
+ return WERR_NOMEM;
ZERO_STRUCTP(r_u->ctr);
@@ -1094,13 +1088,13 @@ NTSTATUS _srv_net_file_enum(pipes_struct *p, SRV_Q_NET_FILE_ENUM *q_u, SRV_R_NET
net conn enum
********************************************************************/
-NTSTATUS _srv_net_conn_enum(pipes_struct *p, SRV_Q_NET_CONN_ENUM *q_u, SRV_R_NET_CONN_ENUM *r_u)
+WERROR _srv_net_conn_enum(pipes_struct *p, SRV_Q_NET_CONN_ENUM *q_u, SRV_R_NET_CONN_ENUM *r_u)
{
DEBUG(5,("srv_net_conn_enum: %d\n", __LINE__));
r_u->ctr = (SRV_CONN_INFO_CTR *)talloc(p->mem_ctx, sizeof(SRV_CONN_INFO_CTR));
if (!r_u->ctr)
- return NT_STATUS_NO_MEMORY;
+ return WERR_NOMEM;
ZERO_STRUCTP(r_u->ctr);
@@ -1119,13 +1113,13 @@ NTSTATUS _srv_net_conn_enum(pipes_struct *p, SRV_Q_NET_CONN_ENUM *q_u, SRV_R_NET
net sess enum
********************************************************************/
-NTSTATUS _srv_net_sess_enum(pipes_struct *p, SRV_Q_NET_SESS_ENUM *q_u, SRV_R_NET_SESS_ENUM *r_u)
+WERROR _srv_net_sess_enum(pipes_struct *p, SRV_Q_NET_SESS_ENUM *q_u, SRV_R_NET_SESS_ENUM *r_u)
{
DEBUG(5,("_srv_net_sess_enum: %d\n", __LINE__));
r_u->ctr = (SRV_SESS_INFO_CTR *)talloc(p->mem_ctx, sizeof(SRV_SESS_INFO_CTR));
if (!r_u->ctr)
- return NT_STATUS_NO_MEMORY;
+ return WERR_NOMEM;
ZERO_STRUCTP(r_u->ctr);
@@ -1144,7 +1138,7 @@ NTSTATUS _srv_net_sess_enum(pipes_struct *p, SRV_Q_NET_SESS_ENUM *q_u, SRV_R_NET
Net share enum all.
********************************************************************/
-NTSTATUS _srv_net_share_enum_all(pipes_struct *p, SRV_Q_NET_SHARE_ENUM *q_u, SRV_R_NET_SHARE_ENUM *r_u)
+WERROR _srv_net_share_enum_all(pipes_struct *p, SRV_Q_NET_SHARE_ENUM *q_u, SRV_R_NET_SHARE_ENUM *r_u)
{
DEBUG(5,("_srv_net_share_enum: %d\n", __LINE__));
@@ -1162,7 +1156,7 @@ NTSTATUS _srv_net_share_enum_all(pipes_struct *p, SRV_Q_NET_SHARE_ENUM *q_u, SRV
Net share enum.
********************************************************************/
-NTSTATUS _srv_net_share_enum(pipes_struct *p, SRV_Q_NET_SHARE_ENUM *q_u, SRV_R_NET_SHARE_ENUM *r_u)
+WERROR _srv_net_share_enum(pipes_struct *p, SRV_Q_NET_SHARE_ENUM *q_u, SRV_R_NET_SHARE_ENUM *r_u)
{
DEBUG(5,("_srv_net_share_enum: %d\n", __LINE__));
@@ -1180,7 +1174,7 @@ NTSTATUS _srv_net_share_enum(pipes_struct *p, SRV_Q_NET_SHARE_ENUM *q_u, SRV_R_N
Net share get info.
********************************************************************/
-NTSTATUS _srv_net_share_get_info(pipes_struct *p, SRV_Q_NET_SHARE_GET_INFO *q_u, SRV_R_NET_SHARE_GET_INFO *r_u)
+WERROR _srv_net_share_get_info(pipes_struct *p, SRV_Q_NET_SHARE_GET_INFO *q_u, SRV_R_NET_SHARE_GET_INFO *r_u)
{
fstring share_name;
@@ -1240,7 +1234,7 @@ static char *valid_share_pathname(char *dos_pathname)
Net share set info. Modify share details.
********************************************************************/
-NTSTATUS _srv_net_share_set_info(pipes_struct *p, SRV_Q_NET_SHARE_SET_INFO *q_u, SRV_R_NET_SHARE_SET_INFO *r_u)
+WERROR _srv_net_share_set_info(pipes_struct *p, SRV_Q_NET_SHARE_SET_INFO *q_u, SRV_R_NET_SHARE_SET_INFO *r_u)
{
struct current_user user;
pstring command;
@@ -1260,27 +1254,27 @@ NTSTATUS _srv_net_share_set_info(pipes_struct *p, SRV_Q_NET_SHARE_SET_INFO *q_u,
r_u->switch_value = 0;
if (strequal(share_name,"IPC$") || strequal(share_name,"ADMIN$") || strequal(share_name,"global"))
- return NT_STATUS_ACCESS_DENIED;
+ return WERR_ACCESS_DENIED;
snum = find_service(share_name);
/* Does this share exist ? */
if (snum < 0)
- return NT_STATUS_BAD_NETWORK_NAME;
+ return WERR_INVALID_NAME;
/* No change to printer shares. */
if (lp_print_ok(snum))
- return NT_STATUS_ACCESS_DENIED;
+ return WERR_ACCESS_DENIED;
get_current_user(&user,p);
if (user.uid != 0)
- return NT_STATUS_ACCESS_DENIED;
+ return WERR_ACCESS_DENIED;
switch (q_u->info_level) {
case 1:
/* Not enough info in a level 1 to do anything. */
- return NT_STATUS_ACCESS_DENIED;
+ return WERR_ACCESS_DENIED;
case 2:
unistr2_to_ascii(comment, &q_u->info.share.info2.info_2_str.uni_remark, sizeof(share_name));
unistr2_to_ascii(pathname, &q_u->info.share.info2.info_2_str.uni_path, sizeof(share_name));
@@ -1295,7 +1289,7 @@ NTSTATUS _srv_net_share_set_info(pipes_struct *p, SRV_Q_NET_SHARE_SET_INFO *q_u,
map_generic_share_sd_bits(psd);
break;
case 1005:
- return NT_STATUS_ACCESS_DENIED;
+ return WERR_ACCESS_DENIED;
case 1501:
fstrcpy(pathname, lp_pathname(snum));
fstrcpy(comment, lp_comment(snum));
@@ -1305,16 +1299,16 @@ NTSTATUS _srv_net_share_set_info(pipes_struct *p, SRV_Q_NET_SHARE_SET_INFO *q_u,
break;
default:
DEBUG(5,("_srv_net_share_set_info: unsupported switch value %d\n", q_u->info_level));
- return NT_STATUS_INVALID_INFO_CLASS;
+ return WERR_UNKNOWN_LEVEL;
}
/* We can only modify disk shares. */
if (type != STYPE_DISKTREE)
- return NT_STATUS_ACCESS_DENIED;
+ return WERR_ACCESS_DENIED;
/* Check if the pathname is valid. */
if (!(ptr = valid_share_pathname( pathname )))
- return NT_STATUS_OBJECT_PATH_INVALID;
+ return WERR_OBJECT_PATH_INVALID;
/* Ensure share name, pathname and comment don't contain '"' characters. */
string_replace(share_name, '"', ' ');
@@ -1328,7 +1322,7 @@ NTSTATUS _srv_net_share_set_info(pipes_struct *p, SRV_Q_NET_SHARE_SET_INFO *q_u,
if (strcmp(ptr, lp_pathname(snum)) || strcmp(comment, lp_comment(snum)) ) {
if (!lp_change_share_cmd() || !*lp_change_share_cmd())
- return NT_STATUS_ACCESS_DENIED;
+ return WERR_ACCESS_DENIED;
slprintf(command, sizeof(command)-1, "%s \"%s\" \"%s\" \"%s\" \"%s\"",
lp_change_share_cmd(), dyn_CONFIGFILE, share_name, ptr, comment);
@@ -1336,12 +1330,11 @@ NTSTATUS _srv_net_share_set_info(pipes_struct *p, SRV_Q_NET_SHARE_SET_INFO *q_u,
DEBUG(10,("_srv_net_share_set_info: Running [%s]\n", command ));
if ((ret = smbrun(command, NULL)) != 0) {
DEBUG(0,("_srv_net_share_set_info: Running [%s] returned (%d)\n", command, ret ));
- return NT_STATUS_ACCESS_DENIED;
+ return WERR_ACCESS_DENIED;
}
/* Tell everyone we updated smb.conf. */
- message_send_all(conn_tdb_ctx(), MSG_SMB_CONF_UPDATED, NULL,
- 0, False, NULL);
+ message_send_all(conn_tdb_ctx(), MSG_SMB_CONF_UPDATED, NULL, 0, False, NULL);
} else {
DEBUG(10,("_srv_net_share_set_info: No change to share name (%s)\n", share_name ));
@@ -1363,14 +1356,14 @@ NTSTATUS _srv_net_share_set_info(pipes_struct *p, SRV_Q_NET_SHARE_SET_INFO *q_u,
DEBUG(5,("_srv_net_share_set_info: %d\n", __LINE__));
- return NT_STATUS_OK;
+ return WERR_OK;
}
/*******************************************************************
Net share add. Call 'add_share_command "sharename" "pathname" "comment" "read only = xxx"'
********************************************************************/
-NTSTATUS _srv_net_share_add(pipes_struct *p, SRV_Q_NET_SHARE_ADD *q_u, SRV_R_NET_SHARE_ADD *r_u)
+WERROR _srv_net_share_add(pipes_struct *p, SRV_Q_NET_SHARE_ADD *q_u, SRV_R_NET_SHARE_ADD *r_u)
{
struct current_user user;
pstring command;
@@ -1391,18 +1384,18 @@ NTSTATUS _srv_net_share_add(pipes_struct *p, SRV_Q_NET_SHARE_ADD *q_u, SRV_R_NET
if (user.uid != 0) {
DEBUG(10,("_srv_net_share_add: uid != 0. Access denied.\n"));
- return NT_STATUS_ACCESS_DENIED;
+ return WERR_ACCESS_DENIED;
}
if (!lp_add_share_cmd() || !*lp_add_share_cmd()) {
DEBUG(10,("_srv_net_share_add: No add share command\n"));
- return NT_STATUS_ACCESS_DENIED;
+ return WERR_ACCESS_DENIED;
}
switch (q_u->info_level) {
case 1:
/* Not enough info in a level 1 to do anything. */
- return NT_STATUS_ACCESS_DENIED;
+ return WERR_ACCESS_DENIED;
case 2:
unistr2_to_ascii(share_name, &q_u->info.share.info2.info_2_str.uni_netname, sizeof(share_name));
unistr2_to_ascii(comment, &q_u->info.share.info2.info_2_str.uni_remark, sizeof(share_name));
@@ -1419,28 +1412,28 @@ NTSTATUS _srv_net_share_add(pipes_struct *p, SRV_Q_NET_SHARE_ADD *q_u, SRV_R_NET
break;
case 1005:
/* DFS only level. */
- return NT_STATUS_ACCESS_DENIED;
+ return WERR_ACCESS_DENIED;
default:
DEBUG(5,("_srv_net_share_add: unsupported switch value %d\n", q_u->info_level));
- return NT_STATUS_INVALID_INFO_CLASS;
+ return WERR_UNKNOWN_LEVEL;
}
if (strequal(share_name,"IPC$") || strequal(share_name,"ADMIN$") || strequal(share_name,"global"))
- return NT_STATUS_ACCESS_DENIED;
+ return WERR_ACCESS_DENIED;
snum = find_service(share_name);
/* Share already exists. */
if (snum >= 0)
- return NT_STATUS_OBJECT_NAME_COLLISION;
+ return WERR_ALREADY_EXISTS;
/* We can only add disk shares. */
if (type != STYPE_DISKTREE)
- return NT_STATUS_ACCESS_DENIED;
+ return WERR_ACCESS_DENIED;
/* Check if the pathname is valid. */
if (!(ptr = valid_share_pathname( pathname )))
- return NT_STATUS_OBJECT_PATH_INVALID;
+ return WERR_OBJECT_PATH_INVALID;
/* Ensure share name, pathname and comment don't contain '"' characters. */
string_replace(share_name, '"', ' ');
@@ -1453,7 +1446,7 @@ NTSTATUS _srv_net_share_add(pipes_struct *p, SRV_Q_NET_SHARE_ADD *q_u, SRV_R_NET
DEBUG(10,("_srv_net_share_add: Running [%s]\n", command ));
if ((ret = smbrun(command, NULL)) != 0) {
DEBUG(0,("_srv_net_share_add: Running [%s] returned (%d)\n", command, ret ));
- return NT_STATUS_ACCESS_DENIED;
+ return WERR_ACCESS_DENIED;
}
if (psd) {
@@ -1463,8 +1456,7 @@ NTSTATUS _srv_net_share_add(pipes_struct *p, SRV_Q_NET_SHARE_ADD *q_u, SRV_R_NET
}
/* Tell everyone we updated smb.conf. */
- message_send_all(conn_tdb_ctx(), MSG_SMB_CONF_UPDATED, NULL, 0, False,
- NULL);
+ message_send_all(conn_tdb_ctx(), MSG_SMB_CONF_UPDATED, NULL, 0, False, NULL);
/*
* We don't call reload_services() here, the message will
@@ -1474,7 +1466,7 @@ NTSTATUS _srv_net_share_add(pipes_struct *p, SRV_Q_NET_SHARE_ADD *q_u, SRV_R_NET
DEBUG(5,("_srv_net_share_add: %d\n", __LINE__));
- return NT_STATUS_OK;
+ return WERR_OK;
}
/*******************************************************************
@@ -1482,7 +1474,7 @@ NTSTATUS _srv_net_share_add(pipes_struct *p, SRV_Q_NET_SHARE_ADD *q_u, SRV_R_NET
a parameter.
********************************************************************/
-NTSTATUS _srv_net_share_del(pipes_struct *p, SRV_Q_NET_SHARE_DEL *q_u, SRV_R_NET_SHARE_DEL *r_u)
+WERROR _srv_net_share_del(pipes_struct *p, SRV_Q_NET_SHARE_DEL *q_u, SRV_R_NET_SHARE_DEL *r_u)
{
struct current_user user;
pstring command;
@@ -1495,24 +1487,24 @@ NTSTATUS _srv_net_share_del(pipes_struct *p, SRV_Q_NET_SHARE_DEL *q_u, SRV_R_NET
unistr2_to_ascii(share_name, &q_u->uni_share_name, sizeof(share_name));
if (strequal(share_name,"IPC$") || strequal(share_name,"ADMIN$") || strequal(share_name,"global"))
- return NT_STATUS_ACCESS_DENIED;
+ return WERR_ACCESS_DENIED;
snum = find_service(share_name);
if (snum < 0)
- return NT_STATUS_BAD_NETWORK_NAME;
+ return WERR_NO_SUCH_SHARE;
/* No change to printer shares. */
if (lp_print_ok(snum))
- return NT_STATUS_ACCESS_DENIED;
+ return WERR_ACCESS_DENIED;
get_current_user(&user,p);
if (user.uid != 0)
- return NT_STATUS_ACCESS_DENIED;
+ return WERR_ACCESS_DENIED;
if (!lp_delete_share_cmd() || !*lp_delete_share_cmd())
- return NT_STATUS_ACCESS_DENIED;
+ return WERR_ACCESS_DENIED;
slprintf(command, sizeof(command)-1, "%s \"%s\" \"%s\"",
lp_delete_share_cmd(), dyn_CONFIGFILE, lp_servicename(snum));
@@ -1520,26 +1512,25 @@ NTSTATUS _srv_net_share_del(pipes_struct *p, SRV_Q_NET_SHARE_DEL *q_u, SRV_R_NET
DEBUG(10,("_srv_net_share_del: Running [%s]\n", command ));
if ((ret = smbrun(command, NULL)) != 0) {
DEBUG(0,("_srv_net_share_del: Running [%s] returned (%d)\n", command, ret ));
- return NT_STATUS_ACCESS_DENIED;
+ return WERR_ACCESS_DENIED;
}
/* Delete the SD in the database. */
delete_share_security(snum);
/* Tell everyone we updated smb.conf. */
- message_send_all(conn_tdb_ctx(), MSG_SMB_CONF_UPDATED, NULL, 0, False,
- NULL);
+ message_send_all(conn_tdb_ctx(), MSG_SMB_CONF_UPDATED, NULL, 0, False, NULL);
lp_killservice(snum);
- return NT_STATUS_OK;
+ return WERR_OK;
}
/*******************************************************************
time of day
********************************************************************/
-NTSTATUS _srv_net_remote_tod(pipes_struct *p, SRV_Q_NET_REMOTE_TOD *q_u, SRV_R_NET_REMOTE_TOD *r_u)
+WERROR _srv_net_remote_tod(pipes_struct *p, SRV_Q_NET_REMOTE_TOD *q_u, SRV_R_NET_REMOTE_TOD *r_u)
{
TIME_OF_DAY_INFO *tod;
struct tm *t;
@@ -1547,13 +1538,13 @@ NTSTATUS _srv_net_remote_tod(pipes_struct *p, SRV_Q_NET_REMOTE_TOD *q_u, SRV_R_N
tod = (TIME_OF_DAY_INFO *)talloc(p->mem_ctx, sizeof(TIME_OF_DAY_INFO));
if (!tod)
- return NT_STATUS_NO_MEMORY;
+ return WERR_NOMEM;
ZERO_STRUCTP(tod);
r_u->tod = tod;
r_u->ptr_srv_tod = 0x1;
- r_u->status = NT_STATUS_OK;
+ r_u->status = WERR_OK;
DEBUG(5,("_srv_net_remote_tod: %d\n", __LINE__));
@@ -1583,7 +1574,7 @@ NTSTATUS _srv_net_remote_tod(pipes_struct *p, SRV_Q_NET_REMOTE_TOD *q_u, SRV_R_N
Win9x NT tools get security descriptor.
***********************************************************************************/
-NTSTATUS _srv_net_file_query_secdesc(pipes_struct *p, SRV_Q_NET_FILE_QUERY_SECDESC *q_u,
+WERROR _srv_net_file_query_secdesc(pipes_struct *p, SRV_Q_NET_FILE_QUERY_SECDESC *q_u,
SRV_R_NET_FILE_QUERY_SECDESC *r_u)
{
SEC_DESC *psd = NULL;
@@ -1599,51 +1590,50 @@ NTSTATUS _srv_net_file_query_secdesc(pipes_struct *p, SRV_Q_NET_FILE_QUERY_SECDE
NTSTATUS nt_status;
struct current_user user;
connection_struct *conn = NULL;
- BOOL became_user = False;
+ BOOL became_user = False;
ZERO_STRUCT(st);
- r_u->status = NT_STATUS_OK;
+ r_u->status = WERR_OK;
unistr2_to_ascii(qualname, &q_u->uni_qual_name, sizeof(qualname));
/* Null password is ok - we are already an authenticated user... */
null_pw = data_blob(NULL, 0);
- get_current_user(&user, p);
-
+ get_current_user(&user, p);
+
become_root();
conn = make_connection(qualname, null_pw, "A:", user.vuid, &nt_status);
unbecome_root();
if (conn == NULL) {
DEBUG(3,("_srv_net_file_query_secdesc: Unable to connect to %s\n", qualname));
- r_u->status = nt_status;
+ r_u->status = ntstatus_to_werror(nt_status);
goto error_exit;
}
if (!become_user(conn, conn->vuid)) {
DEBUG(0,("_srv_net_file_query_secdesc: Can't become connected user!\n"));
- r_u->status = NT_STATUS_ACCESS_DENIED;
+ r_u->status = WERR_ACCESS_DENIED;
goto error_exit;
}
- became_user = True;
+ became_user = True;
unistr2_to_ascii(filename, &q_u->uni_file_name, sizeof(filename));
unix_convert(filename, conn, NULL, &bad_path, &st);
-
fsp = open_file_shared(conn, filename, &st, SET_OPEN_MODE(DOS_OPEN_RDONLY),
- (FILE_FAIL_IF_NOT_EXIST|FILE_EXISTS_OPEN), 0, 0, &access_mode, &action);
+ (FILE_FAIL_IF_NOT_EXIST|FILE_EXISTS_OPEN), 0, 0, &access_mode, &action);
if (!fsp) {
/* Perhaps it is a directory */
if (errno == EISDIR)
fsp = open_directory(conn, filename, &st,0,
- (FILE_FAIL_IF_NOT_EXIST|FILE_EXISTS_OPEN), 0, &action);
+ (FILE_FAIL_IF_NOT_EXIST|FILE_EXISTS_OPEN), 0, &action);
if (!fsp) {
DEBUG(3,("_srv_net_file_query_secdesc: Unable to open file %s\n", filename));
- r_u->status = NT_STATUS_ACCESS_DENIED;
+ r_u->status = WERR_ACCESS_DENIED;
goto error_exit;
}
}
@@ -1652,7 +1642,7 @@ NTSTATUS _srv_net_file_query_secdesc(pipes_struct *p, SRV_Q_NET_FILE_QUERY_SECDE
if (sd_size == 0) {
DEBUG(3,("_srv_net_file_query_secdesc: Unable to get NT ACL for file %s\n", filename));
- r_u->status = NT_STATUS_ACCESS_DENIED;
+ r_u->status = WERR_ACCESS_DENIED;
goto error_exit;
}
@@ -1688,13 +1678,13 @@ NTSTATUS _srv_net_file_query_secdesc(pipes_struct *p, SRV_Q_NET_FILE_QUERY_SECDE
Win9x NT tools set security descriptor.
***********************************************************************************/
-NTSTATUS _srv_net_file_set_secdesc(pipes_struct *p, SRV_Q_NET_FILE_SET_SECDESC *q_u,
+WERROR _srv_net_file_set_secdesc(pipes_struct *p, SRV_Q_NET_FILE_SET_SECDESC *q_u,
SRV_R_NET_FILE_SET_SECDESC *r_u)
{
BOOL ret;
- DATA_BLOB null_pw;
pstring filename;
pstring qualname;
+ DATA_BLOB null_pw;
files_struct *fsp = NULL;
SMB_STRUCT_STAT st;
BOOL bad_path;
@@ -1702,33 +1692,34 @@ NTSTATUS _srv_net_file_set_secdesc(pipes_struct *p, SRV_Q_NET_FILE_SET_SECDESC *
int action;
NTSTATUS nt_status;
struct current_user user;
+ fstring user_name;
connection_struct *conn = NULL;
BOOL became_user = False;
ZERO_STRUCT(st);
- r_u->status = NT_STATUS_OK;
+ r_u->status = WERR_OK;
unistr2_to_ascii(qualname, &q_u->uni_qual_name, sizeof(qualname));
/* Null password is ok - we are already an authenticated user... */
null_pw = data_blob(NULL, 0);
- get_current_user(&user, p);
-
+ get_current_user(&user, p);
+
become_root();
conn = make_connection(qualname, null_pw, "A:", user.vuid, &nt_status);
unbecome_root();
if (conn == NULL) {
DEBUG(3,("_srv_net_file_set_secdesc: Unable to connect to %s\n", qualname));
- r_u->status = nt_status;
+ r_u->status = ntstatus_to_werror(nt_status);
goto error_exit;
}
if (!become_user(conn, conn->vuid)) {
DEBUG(0,("_srv_net_file_set_secdesc: Can't become connected user!\n"));
- r_u->status = NT_STATUS_ACCESS_DENIED;
+ r_u->status = WERR_ACCESS_DENIED;
goto error_exit;
}
became_user = True;
@@ -1737,17 +1728,17 @@ NTSTATUS _srv_net_file_set_secdesc(pipes_struct *p, SRV_Q_NET_FILE_SET_SECDESC *
unix_convert(filename, conn, NULL, &bad_path, &st);
fsp = open_file_shared(conn, filename, &st, SET_OPEN_MODE(DOS_OPEN_RDWR),
- (FILE_FAIL_IF_NOT_EXIST|FILE_EXISTS_OPEN), 0, 0, &access_mode, &action);
+ (FILE_FAIL_IF_NOT_EXIST|FILE_EXISTS_OPEN), 0, 0, &access_mode, &action);
if (!fsp) {
/* Perhaps it is a directory */
if (errno == EISDIR)
fsp = open_directory(conn, filename, &st,0,
- (FILE_FAIL_IF_NOT_EXIST|FILE_EXISTS_OPEN), 0, &action);
+ (FILE_FAIL_IF_NOT_EXIST|FILE_EXISTS_OPEN), 0, &action);
if (!fsp) {
DEBUG(3,("_srv_net_file_set_secdesc: Unable to open file %s\n", filename));
- r_u->status = NT_STATUS_ACCESS_DENIED;
+ r_u->status = WERR_ACCESS_DENIED;
goto error_exit;
}
}
@@ -1756,7 +1747,7 @@ NTSTATUS _srv_net_file_set_secdesc(pipes_struct *p, SRV_Q_NET_FILE_SET_SECDESC *
if (ret == False) {
DEBUG(3,("_srv_net_file_set_secdesc: Unable to set NT ACL on file %s\n", filename));
- r_u->status = NT_STATUS_ACCESS_DENIED;
+ r_u->status = WERR_ACCESS_DENIED;
goto error_exit;
}
@@ -1826,19 +1817,19 @@ static const char *next_server_disk_enum(uint32 *resume)
return disk;
}
-NTSTATUS _srv_net_disk_enum(pipes_struct *p, SRV_Q_NET_DISK_ENUM *q_u, SRV_R_NET_DISK_ENUM *r_u)
+WERROR _srv_net_disk_enum(pipes_struct *p, SRV_Q_NET_DISK_ENUM *q_u, SRV_R_NET_DISK_ENUM *r_u)
{
uint32 i;
const char *disk_name;
uint32 resume=get_enum_hnd(&q_u->enum_hnd);
- r_u->status=NT_STATUS_OK;
+ r_u->status=WERR_OK;
r_u->total_entries = init_server_disk_enum(&resume);
r_u->disk_enum_ctr.unknown = 0;
- r_u->disk_enum_ctr.disk_info_ptr = r_u->disk_enum_ctr.disk_info? 1 : 0;
+ r_u->disk_enum_ctr.disk_info_ptr = r_u->disk_enum_ctr.disk_info ? 1 : 0;
/*allow one DISK_INFO for null terminator*/
@@ -1862,12 +1853,12 @@ NTSTATUS _srv_net_disk_enum(pipes_struct *p, SRV_Q_NET_DISK_ENUM *q_u, SRV_R_NET
return r_u->status;
}
-NTSTATUS _srv_net_name_validate(pipes_struct *p, SRV_Q_NET_NAME_VALIDATE *q_u, SRV_R_NET_NAME_VALIDATE *r_u)
+WERROR _srv_net_name_validate(pipes_struct *p, SRV_Q_NET_NAME_VALIDATE *q_u, SRV_R_NET_NAME_VALIDATE *r_u)
{
int snum;
fstring share_name;
- r_u->status=NT_STATUS_OK;
+ r_u->status=WERR_OK;
switch(q_u->type) {
@@ -1881,12 +1872,12 @@ NTSTATUS _srv_net_name_validate(pipes_struct *p, SRV_Q_NET_NAME_VALIDATE *q_u, S
/* Share already exists. */
if (snum >= 0)
- r_u->status = NT_STATUS_OBJECT_NAME_INVALID;
+ r_u->status = WERR_ALREADY_EXISTS;
break;
default:
/*unsupported type*/
- r_u->status = NT_STATUS_INVALID_LEVEL;
+ r_u->status = WERR_UNKNOWN_LEVEL;
break;
}