diff options
author | Simo Sorce <idra@samba.org> | 2004-02-19 15:45:40 +0000 |
---|---|---|
committer | Simo Sorce <idra@samba.org> | 2004-02-19 15:45:40 +0000 |
commit | 6c038e463f2c76a5b1fd03d2adaf17cfd95a32b6 (patch) | |
tree | e6339f6c8d451ce3527b089a7fd29b359b4e4509 /source3 | |
parent | cc5dc7cb6733c27ec763f8e660aaeb321563fa1e (diff) | |
download | samba-6c038e463f2c76a5b1fd03d2adaf17cfd95a32b6.tar.gz samba-6c038e463f2c76a5b1fd03d2adaf17cfd95a32b6.tar.bz2 samba-6c038e463f2c76a5b1fd03d2adaf17cfd95a32b6.zip |
reformatting
(This used to be commit cd48827418d8be15470e833ea19ab9830e160e12)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/smbd/lanman.c | 138 |
1 files changed, 69 insertions, 69 deletions
diff --git a/source3/smbd/lanman.c b/source3/smbd/lanman.c index c4df84e76c..d715ab4ddc 100644 --- a/source3/smbd/lanman.c +++ b/source3/smbd/lanman.c @@ -1557,87 +1557,87 @@ static BOOL api_RNetShareAdd(connection_struct *conn,uint16 vuid, char *param,ch char **rdata,char **rparam, int *rdata_len,int *rparam_len) { - char *str1 = param+2; - char *str2 = skip_string(str1,1); - char *p = skip_string(str2,1); - int uLevel = SVAL(p,0); - fstring sharename; - fstring comment; - pstring pathname; - char *command, *cmdname; - unsigned int offset; - int snum; - int res = ERRunsup; + char *str1 = param+2; + char *str2 = skip_string(str1,1); + char *p = skip_string(str2,1); + int uLevel = SVAL(p,0); + fstring sharename; + fstring comment; + pstring pathname; + char *command, *cmdname; + unsigned int offset; + int snum; + int res = ERRunsup; - /* check it's a supported varient */ - if (!prefix_ok(str1,RAP_WShareAdd_REQ)) return False; - if (!check_share_info(uLevel,str2)) return False; - if (uLevel != 2) return False; - - pull_ascii_fstring(sharename,data); - snum = find_service(sharename); - if (snum >= 0) { /* already exists */ - res = ERRfilexists; - goto error_exit; - } + /* check it's a supported varient */ + if (!prefix_ok(str1, RAP_WShareAdd_REQ)) return False; + if (!check_share_info(uLevel, str2)) return False; + if (uLevel != 2) return False; + + pull_ascii_fstring(sharename, data); + snum = find_service(sharename); + if (snum >= 0) { /* already exists */ + res = ERRfilexists; + goto error_exit; + } - /* only support disk share adds */ - if (SVAL(data,14)!=STYPE_DISKTREE) return False; + /* only support disk share adds */ + if (SVAL(data,14) != STYPE_DISKTREE) return False; - offset = IVAL(data, 16); - if (offset >= mdrcnt) { - res = ERRinvalidparam; - goto error_exit; - } - pull_ascii_fstring(comment, offset? (data+offset) : ""); + offset = IVAL(data, 16); + if (offset >= mdrcnt) { + res = ERRinvalidparam; + goto error_exit; + } + pull_ascii_fstring(comment, offset? (data+offset) : ""); - offset = IVAL(data, 26); - if (offset >= mdrcnt) { - res = ERRinvalidparam; - goto error_exit; - } - pull_ascii_pstring(pathname, offset? (data+offset) : ""); + offset = IVAL(data, 26); + if (offset >= mdrcnt) { + res = ERRinvalidparam; + goto error_exit; + } + pull_ascii_pstring(pathname, offset? (data+offset) : ""); - string_replace(sharename, '"', ' '); - string_replace(pathname, '"', ' '); - string_replace(comment, '"', ' '); + string_replace(sharename, '"', ' '); + string_replace(pathname, '"', ' '); + string_replace(comment, '"', ' '); - cmdname = lp_add_share_cmd(); + cmdname = lp_add_share_cmd(); - if (!cmdname || *cmdname == '\0') return False; + if (!cmdname || *cmdname == '\0') return False; - asprintf(&command, "%s \"%s\" \"%s\" \"%s\" \"%s\"", - lp_add_share_cmd(), dyn_CONFIGFILE, sharename, pathname, comment); + asprintf(&command, "%s \"%s\" \"%s\" \"%s\" \"%s\"", + lp_add_share_cmd(), dyn_CONFIGFILE, sharename, pathname, comment); - if (command) { - DEBUG(10,("api_RNetShareAdd: Running [%s]\n", command )); - if ((res = smbrun(command, NULL)) != 0) { - DEBUG(1,("api_RNetShareAdd: Running [%s] returned (%d)\n", command, res )); - SAFE_FREE(command); - res = ERRnoaccess; - goto error_exit; - } else { - SAFE_FREE(command); - message_send_all(conn_tdb_ctx(), MSG_SMB_CONF_UPDATED, NULL, 0, False, NULL); - } - } else return False; + if (command) { + DEBUG(10,("api_RNetShareAdd: Running [%s]\n", command )); + if ((res = smbrun(command, NULL)) != 0) { + DEBUG(1,("api_RNetShareAdd: Running [%s] returned (%d)\n", command, res )); + SAFE_FREE(command); + res = ERRnoaccess; + goto error_exit; + } else { + SAFE_FREE(command); + message_send_all(conn_tdb_ctx(), MSG_SMB_CONF_UPDATED, NULL, 0, False, NULL); + } + } else return False; - *rparam_len = 6; - *rparam = REALLOC(*rparam,*rparam_len); - SSVAL(*rparam,0,NERR_Success); - SSVAL(*rparam,2,0); /* converter word */ - SSVAL(*rparam,4,*rdata_len); - *rdata_len = 0; + *rparam_len = 6; + *rparam = REALLOC(*rparam, *rparam_len); + SSVAL(*rparam, 0, NERR_Success); + SSVAL(*rparam, 2, 0); /* converter word */ + SSVAL(*rparam, 4, *rdata_len); + *rdata_len = 0; - return True; + return True; - error_exit: - *rparam_len = 4; - *rparam = REALLOC(*rparam,*rparam_len); - *rdata_len = 0; - SSVAL(*rparam,0,res); - SSVAL(*rparam,2,0); - return True; +error_exit: + *rparam_len = 4; + *rparam = REALLOC(*rparam, *rparam_len); + *rdata_len = 0; + SSVAL(*rparam, 0, res); + SSVAL(*rparam, 2, 0); + return True; } |