diff options
author | Simo Sorce <idra@samba.org> | 2006-09-12 02:24:21 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:18:25 -0500 |
commit | 7736d2f65cf0479c6a1588e3656809047a4b3d49 (patch) | |
tree | d5c83a090e3d177a40b9d6db8b13cd7e4f25511a /source4/rpc_server/srvsvc | |
parent | 33c4fea4cdf7d5418423a81e53ce7b051500f287 (diff) | |
download | samba-7736d2f65cf0479c6a1588e3656809047a4b3d49.tar.gz samba-7736d2f65cf0479c6a1588e3656809047a4b3d49.tar.bz2 samba-7736d2f65cf0479c6a1588e3656809047a4b3d49.zip |
r18412: Implement NetiNameValidate but just for share name right now (type 9)
Simo.
(This used to be commit 906429834a102349582017ef73a69e211ef5c500)
Diffstat (limited to 'source4/rpc_server/srvsvc')
-rw-r--r-- | source4/rpc_server/srvsvc/dcesrv_srvsvc.c | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c index d850af5ebd..2464da447a 100644 --- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c +++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c @@ -1273,7 +1273,47 @@ static WERROR srvsvc_NetPathCompare(struct dcesrv_call_state *dce_call, TALLOC_C static WERROR srvsvc_NetNameValidate(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct srvsvc_NetNameValidate *r) { - DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); + int len; + + if ((r->in.flags != 0x0) && (r->in.flags != 0x80000000)) { + return WERR_INVALID_NAME; + } + + switch (r->in.name_type) { + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + return WERR_NOT_SUPPORTED; + + case 9: /* validate share name */ + + len = strlen_m(r->in.name); + if ((r->in.flags == 0x0) && (len > 81)) { + return WERR_INVALID_NAME; + } + if ((r->in.flags == 0x80000000) && (len > 13)) { + return WERR_INVALID_NAME; + } + if (! dcesrv_common_validate_share_name(mem_ctx, r->in.name)) { + return WERR_INVALID_NAME; + } + return WERR_OK; + + case 10: + case 11: + case 12: + case 13: + return WERR_NOT_SUPPORTED; + default: + return WERR_INVALID_PARAM; + } + + return WERR_INVALID_PARAM; } |