return 0;
}
l = push_ascii(*dst,buf,*p_space_remaining, STR_TERMINATE);
- if (l == -1) {
+ if (l == 0) {
return 0;
}
(*dst) += l;
return 0;
}
l = push_ascii(*dst,src,*n, STR_TERMINATE);
- if (l == -1) {
+ if (l == 0) {
return 0;
}
(*dst) += l;
int needed=0, stringneeded;
const char *str=NULL;
int is_string=0, stringused;
- int32 temp;
+ int32_t temp;
va_start(args,p);
{
char *s = va_arg(args,char*);
if (p->buflen >= needed) {
- StrnCpy(p->structbuf,s?s:"",needed-1);
+ strlcpy(p->structbuf,s?s:"",needed);
}
}
break;
ZERO_STRUCT(handle);
if (QueueName == NULL || (strlen(QueueName) < 1)) {
- desc.errcode = W_ERROR_V(WERR_INVALID_PARAM);
+ desc.errcode = W_ERROR_V(WERR_INVALID_PARAMETER);
goto out;
}
- status = rpc_pipe_open_interface(conn,
- &ndr_table_spoolss.syntax_id,
+ status = rpc_pipe_open_interface(mem_ctx,
+ &ndr_table_spoolss,
conn->session_info,
conn->sconn->remote_address,
+ conn->sconn->local_address,
conn->sconn->msg_ctx,
&cli);
if (!NT_STATUS_IS_OK(status)) {
return(True);
}
- status = rpc_pipe_open_interface(conn,
- &ndr_table_spoolss.syntax_id,
+ status = rpc_pipe_open_interface(mem_ctx,
+ &ndr_table_spoolss,
conn->session_info,
conn->sconn->remote_address,
+ conn->sconn->local_address,
conn->sconn->msg_ctx,
&cli);
if (!NT_STATUS_IS_OK(status)) {
}
}
- SAFE_FREE(subcntarr);
out:
+ SAFE_FREE(subcntarr);
*rdata_len = desc.usedlen;
*rparam_len = 8;
*rparam = smb_realloc_limit(*rparam,*rparam_len);
struct srv_info_struct {
fstring name;
- uint32 type;
+ uint32_t type;
fstring comment;
fstring domain;
bool server_added;
number of entries.
******************************************************************/
-static int get_session_info(uint32 servertype,
+static int get_session_info(uint32_t servertype,
struct srv_info_struct **servers,
const char *domain)
{
char **lines;
bool local_list_only;
int i;
+ char *slist_cache_path = cache_path(talloc_tos(), SERVER_LIST);
+ if (slist_cache_path == NULL) {
+ return 0;
+ }
- lines = file_lines_load(cache_path(SERVER_LIST), NULL, 0, NULL);
+ lines = file_lines_load(slist_cache_path, NULL, 0, NULL);
if (!lines) {
- DEBUG(4,("Can't open %s - %s\n",cache_path(SERVER_LIST),strerror(errno)));
+ DEBUG(4, ("Can't open %s - %s\n",
+ slist_cache_path, strerror(errno)));
+ TALLOC_FREE(slist_cache_path);
return 0;
}
+ TALLOC_FREE(slist_cache_path);
/* request for everything is code for request all servers */
if (servertype == SV_TYPE_ALL) {
char *p = skip_string(param,tpscnt,str2);
int uLevel = get_safe_SVAL(param, tpscnt, p, 0, -1);
int buf_len = get_safe_SVAL(param,tpscnt, p, 2, 0);
- uint32 servertype = get_safe_IVAL(param,tpscnt,p,4, 0);
+ uint32_t servertype = get_safe_IVAL(param,tpscnt,p,4, 0);
char *p2;
int data_len, fixed_len, string_len;
int f_len = 0, s_len = 0;
char *p = skip_string(param,tpscnt,str2);
int uLevel = get_safe_SVAL(param, tpscnt, p, 0, -1);
int buf_len = get_safe_SVAL(param,tpscnt, p, 2, 0);
- uint32 servertype = get_safe_IVAL(param,tpscnt,p,4, 0);
+ uint32_t servertype = get_safe_IVAL(param,tpscnt,p,4, 0);
char *p2;
int data_len, fixed_len, string_len;
int f_len = 0, s_len = 0;
len += StrlenExpanded(conn,snum,lp_comment(talloc_tos(), snum));
}
if (uLevel > 1) {
- len += strlen(lp_pathname(talloc_tos(), snum)) + 1;
+ len += strlen(lp_path(talloc_tos(), snum)) + 1;
}
if (buflen) {
*buflen = struct_len;
SCVAL(p,13,0);
type = STYPE_DISKTREE;
- if (lp_print_ok(snum)) {
+ if (lp_printable(snum)) {
type = STYPE_PRINTQ;
}
- if (strequal("IPC",lp_fstype(talloc_tos(),snum))) {
+ if (strequal("IPC",lp_fstype(snum))) {
type = STYPE_IPC;
}
SSVAL(p,14,type); /* device type */
SSVALS(p,22,-1); /* max uses */
SSVAL(p,24,1); /* current uses */
SIVAL(p,26,PTR_DIFF(p2,baseaddr)); /* local pathname */
- len += CopyAndAdvance(&p2,lp_pathname(talloc_tos(),snum),&l2);
+ len += CopyAndAdvance(&p2,lp_path(talloc_tos(),snum),&l2);
memset(p+30,0,SHPWLEN+2); /* passwd (reserved), pad field */
}
/* Ensure all the usershares are loaded. */
become_root();
+ delete_and_reload_printers();
load_registry_shares();
count = load_usershare_shares(NULL, connections_snum_used);
unbecome_root();
return false;
}
- status = rpc_pipe_open_interface(mem_ctx, &ndr_table_srvsvc.syntax_id,
+ status = rpc_pipe_open_interface(mem_ctx, &ndr_table_srvsvc,
conn->session_info,
conn->sconn->remote_address,
+ conn->sconn->local_address,
conn->sconn->msg_ctx,
&cli);
if (!NT_STATUS_IS_OK(status)) {
uint32_t num_groups;
uint32_t resume_handle;
- struct rpc_pipe_client *samr_pipe;
+ struct rpc_pipe_client *samr_pipe = NULL;
struct policy_handle samr_handle, domain_handle;
NTSTATUS status, result;
struct dcerpc_binding_handle *b;
}
status = rpc_pipe_open_interface(
- talloc_tos(), &ndr_table_samr.syntax_id,
+ talloc_tos(), &ndr_table_samr,
conn->session_info, conn->sconn->remote_address,
- conn->sconn->msg_ctx, &samr_pipe);
+ conn->sconn->local_address, conn->sconn->msg_ctx, &samr_pipe);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("api_RNetUserEnum: Could not connect to samr: %s\n",
nt_errstr(status)));
uint32_t i;
char *endp = NULL;
- struct rpc_pipe_client *samr_pipe;
+ struct rpc_pipe_client *samr_pipe = NULL;
struct policy_handle samr_handle, domain_handle, user_handle;
struct lsa_String name;
struct lsa_Strings names;
endp = *rdata + *rdata_len;
status = rpc_pipe_open_interface(
- talloc_tos(), &ndr_table_samr.syntax_id,
+ talloc_tos(), &ndr_table_samr,
conn->session_info, conn->sconn->remote_address,
- conn->sconn->msg_ctx, &samr_pipe);
+ conn->sconn->local_address, conn->sconn->msg_ctx, &samr_pipe);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("api_RNetUserEnum: Could not connect to samr: %s\n",
nt_errstr(status)));
nt_errstr(result)));
goto close_domain;
}
+ if (rid.count != 1) {
+ status = NT_STATUS_INVALID_NETWORK_RESPONSE;
+ goto close_domain;
+ }
+ if (type.count != 1) {
+ status = NT_STATUS_INVALID_NETWORK_RESPONSE;
+ goto close_domain;
+ }
if (type.ids[0] != SID_NAME_USER) {
DEBUG(10, ("%s is a %s, not a user\n", UserName,
int i, resume_context, cli_buf_size;
uint32_t resume_handle;
- struct rpc_pipe_client *samr_pipe;
+ struct rpc_pipe_client *samr_pipe = NULL;
struct policy_handle samr_handle, domain_handle;
NTSTATUS status, result;
endp = *rdata + *rdata_len;
status = rpc_pipe_open_interface(
- talloc_tos(), &ndr_table_samr.syntax_id,
+ talloc_tos(), &ndr_table_samr,
conn->session_info, conn->sconn->remote_address,
- conn->sconn->msg_ctx, &samr_pipe);
+ conn->sconn->local_address, conn->sconn->msg_ctx, &samr_pipe);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("api_RNetUserEnum: Could not connect to samr: %s\n",
nt_errstr(status)));
return True;
}
-/****************************************************************************
- Set the user password.
-*****************************************************************************/
-
-static bool api_SetUserPassword(struct smbd_server_connection *sconn,
- connection_struct *conn,uint64_t vuid,
- char *param, int tpscnt,
- char *data, int tdscnt,
- int mdrcnt,int mprcnt,
- char **rdata,char **rparam,
- int *rdata_len,int *rparam_len)
-{
- char *np = get_safe_str_ptr(param,tpscnt,param,2);
- char *p = NULL;
- fstring user;
- fstring pass1,pass2;
- TALLOC_CTX *mem_ctx = talloc_tos();
- NTSTATUS status, result;
- struct rpc_pipe_client *cli = NULL;
- struct policy_handle connect_handle, domain_handle, user_handle;
- struct lsa_String domain_name;
- struct dom_sid2 *domain_sid;
- struct lsa_String names;
- struct samr_Ids rids;
- struct samr_Ids types;
- struct samr_Password old_lm_hash;
- struct samr_Password new_lm_hash;
- int errcode = NERR_badpass;
- uint32_t rid;
- int encrypted;
- int min_pwd_length;
- struct dcerpc_binding_handle *b = NULL;
-
- /* Skip 2 strings. */
- p = skip_string(param,tpscnt,np);
- p = skip_string(param,tpscnt,p);
-
- if (!np || !p) {
- return False;
- }
-
- /* Do we have a string ? */
- if (skip_string(param,tpscnt,p) == NULL) {
- return False;
- }
- pull_ascii_fstring(user,p);
-
- p = skip_string(param,tpscnt,p);
- if (!p) {
- return False;
- }
-
- memset(pass1,'\0',sizeof(pass1));
- memset(pass2,'\0',sizeof(pass2));
- /*
- * We use 31 here not 32 as we're checking
- * the last byte we want to access is safe.
- */
- if (!is_offset_safe(param,tpscnt,p,31)) {
- return False;
- }
- memcpy(pass1,p,16);
- memcpy(pass2,p+16,16);
-
- encrypted = get_safe_SVAL(param,tpscnt,p+32,0,-1);
- if (encrypted == -1) {
- errcode = W_ERROR_V(WERR_INVALID_PARAM);
- goto out;
- }
-
- min_pwd_length = get_safe_SVAL(param,tpscnt,p+34,0,-1);
- if (min_pwd_length == -1) {
- errcode = W_ERROR_V(WERR_INVALID_PARAM);
- goto out;
- }
-
- *rparam_len = 4;
- *rparam = smb_realloc_limit(*rparam,*rparam_len);
- if (!*rparam) {
- return False;
- }
-
- *rdata_len = 0;
-
- DEBUG(3,("Set password for <%s> (encrypted: %d, min_pwd_length: %d)\n",
- user, encrypted, min_pwd_length));
-
- ZERO_STRUCT(connect_handle);
- ZERO_STRUCT(domain_handle);
- ZERO_STRUCT(user_handle);
-
- status = rpc_pipe_open_interface(mem_ctx, &ndr_table_samr.syntax_id,
- conn->session_info,
- conn->sconn->remote_address,
- conn->sconn->msg_ctx,
- &cli);
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0,("api_SetUserPassword: could not connect to samr: %s\n",
- nt_errstr(status)));
- errcode = W_ERROR_V(ntstatus_to_werror(status));
- goto out;
- }
-
- b = cli->binding_handle;
-
- status = dcerpc_samr_Connect2(b, mem_ctx,
- lp_netbios_name(),
- SAMR_ACCESS_CONNECT_TO_SERVER |
- SAMR_ACCESS_ENUM_DOMAINS |
- SAMR_ACCESS_LOOKUP_DOMAIN,
- &connect_handle,
- &result);
- if (!NT_STATUS_IS_OK(status)) {
- errcode = W_ERROR_V(ntstatus_to_werror(status));
- goto out;
- }
- if (!NT_STATUS_IS_OK(result)) {
- errcode = W_ERROR_V(ntstatus_to_werror(result));
- goto out;
- }
-
- init_lsa_String(&domain_name, get_global_sam_name());
-
- status = dcerpc_samr_LookupDomain(b, mem_ctx,
- &connect_handle,
- &domain_name,
- &domain_sid,
- &result);
- if (!NT_STATUS_IS_OK(status)) {
- errcode = W_ERROR_V(ntstatus_to_werror(status));
- goto out;
- }
- if (!NT_STATUS_IS_OK(result)) {
- errcode = W_ERROR_V(ntstatus_to_werror(result));
- goto out;
- }
-
- status = dcerpc_samr_OpenDomain(b, mem_ctx,
- &connect_handle,
- SAMR_DOMAIN_ACCESS_OPEN_ACCOUNT,
- domain_sid,
- &domain_handle,
- &result);
- if (!NT_STATUS_IS_OK(status)) {
- errcode = W_ERROR_V(ntstatus_to_werror(status));
- goto out;
- }
- if (!NT_STATUS_IS_OK(result)) {
- errcode = W_ERROR_V(ntstatus_to_werror(result));
- goto out;
- }
-
- init_lsa_String(&names, user);
-
- status = dcerpc_samr_LookupNames(b, mem_ctx,
- &domain_handle,
- 1,
- &names,
- &rids,
- &types,
- &result);
- if (!NT_STATUS_IS_OK(status)) {
- errcode = W_ERROR_V(ntstatus_to_werror(status));
- goto out;
- }
- if (!NT_STATUS_IS_OK(result)) {
- errcode = W_ERROR_V(ntstatus_to_werror(result));
- goto out;
- }
-
- if (rids.count != 1) {
- errcode = W_ERROR_V(WERR_NO_SUCH_USER);
- goto out;
- }
- if (rids.count != types.count) {
- errcode = W_ERROR_V(WERR_INVALID_PARAM);
- goto out;
- }
- if (types.ids[0] != SID_NAME_USER) {
- errcode = W_ERROR_V(WERR_INVALID_PARAM);
- goto out;
- }
-
- rid = rids.ids[0];
-
- status = dcerpc_samr_OpenUser(b, mem_ctx,
- &domain_handle,
- SAMR_USER_ACCESS_CHANGE_PASSWORD,
- rid,
- &user_handle,
- &result);
- if (!NT_STATUS_IS_OK(status)) {
- errcode = W_ERROR_V(ntstatus_to_werror(status));
- goto out;
- }
- if (!NT_STATUS_IS_OK(result)) {
- errcode = W_ERROR_V(ntstatus_to_werror(result));
- goto out;
- }
-
- if (encrypted == 0) {
- E_deshash(pass1, old_lm_hash.hash);
- E_deshash(pass2, new_lm_hash.hash);
- } else {
- ZERO_STRUCT(old_lm_hash);
- ZERO_STRUCT(new_lm_hash);
- memcpy(old_lm_hash.hash, pass1, MIN(strlen(pass1), 16));
- memcpy(new_lm_hash.hash, pass2, MIN(strlen(pass2), 16));
- }
-
- status = dcerpc_samr_ChangePasswordUser(b, mem_ctx,
- &user_handle,
- true, /* lm_present */
- &old_lm_hash,
- &new_lm_hash,
- false, /* nt_present */
- NULL, /* old_nt_crypted */
- NULL, /* new_nt_crypted */
- false, /* cross1_present */
- NULL, /* nt_cross */
- false, /* cross2_present */
- NULL, /* lm_cross */
- &result);
- if (!NT_STATUS_IS_OK(status)) {
- errcode = W_ERROR_V(ntstatus_to_werror(status));
- goto out;
- }
- if (!NT_STATUS_IS_OK(result)) {
- errcode = W_ERROR_V(ntstatus_to_werror(result));
- goto out;
- }
-
- errcode = NERR_Success;
- out:
-
- if (b && is_valid_policy_hnd(&user_handle)) {
- dcerpc_samr_Close(b, mem_ctx, &user_handle, &result);
- }
- if (b && is_valid_policy_hnd(&domain_handle)) {
- dcerpc_samr_Close(b, mem_ctx, &domain_handle, &result);
- }
- if (b && is_valid_policy_hnd(&connect_handle)) {
- dcerpc_samr_Close(b, mem_ctx, &connect_handle, &result);
- }
-
- memset((char *)pass1,'\0',sizeof(fstring));
- memset((char *)pass2,'\0',sizeof(fstring));
-
- SSVAL(*rparam,0,errcode);
- SSVAL(*rparam,2,0); /* converter word */
- return(True);
-}
-
/****************************************************************************
Set the user password (SamOEM version - gets plaintext).
****************************************************************************/
DEBUG(3,("api_SamOEMChangePassword: Change password for <%s>\n",user));
if (tdscnt != 532) {
- errcode = W_ERROR_V(WERR_INVALID_PARAM);
+ errcode = W_ERROR_V(WERR_INVALID_PARAMETER);
goto out;
}
bufsize = get_safe_SVAL(param,tpscnt,p,0,-1);
if (bufsize != 532) {
- errcode = W_ERROR_V(WERR_INVALID_PARAM);
+ errcode = W_ERROR_V(WERR_INVALID_PARAMETER);
goto out;
}
memcpy(password.data, data, 516);
memcpy(hash.hash, data+516, 16);
- status = rpc_pipe_open_interface(mem_ctx, &ndr_table_samr.syntax_id,
+ status = rpc_pipe_open_interface(mem_ctx, &ndr_table_samr,
conn->session_info,
conn->sconn->remote_address,
+ conn->sconn->local_address,
conn->sconn->msg_ctx,
&cli);
if (!NT_STATUS_IS_OK(status)) {
char *str1 = get_safe_str_ptr(param,tpscnt,param,2);
char *str2 = skip_string(param,tpscnt,str1);
char *p = skip_string(param,tpscnt,str2);
- uint32 jobid;
+ uint32_t jobid;
fstring sharename;
int errcode;
WERROR werr = WERR_OK;
ZERO_STRUCT(handle);
- status = rpc_pipe_open_interface(conn,
- &ndr_table_spoolss.syntax_id,
+ status = rpc_pipe_open_interface(mem_ctx,
+ &ndr_table_spoolss,
conn->session_info,
conn->sconn->remote_address,
+ conn->sconn->local_address,
conn->sconn->msg_ctx,
&cli);
if (!NT_STATUS_IS_OK(status)) {
ZERO_STRUCT(handle);
- status = rpc_pipe_open_interface(conn,
- &ndr_table_spoolss.syntax_id,
+ status = rpc_pipe_open_interface(mem_ctx,
+ &ndr_table_spoolss,
conn->session_info,
conn->sconn->remote_address,
+ conn->sconn->local_address,
conn->sconn->msg_ctx,
&cli);
if (!NT_STATUS_IS_OK(status)) {
QueueName,
NULL,
devmode_ctr,
- SEC_FLAG_MAXIMUM_ALLOWED,
+ PRINTER_ACCESS_ADMINISTER,
&handle,
&werr);
if (!NT_STATUS_IS_OK(status)) {
char *str1 = get_safe_str_ptr(param,tpscnt,param,2);
char *str2 = skip_string(param,tpscnt,str1);
char *p = skip_string(param,tpscnt,str2);
- uint32 jobid;
+ uint32_t jobid;
fstring sharename;
int uLevel = get_safe_SVAL(param,tpscnt,p,2,-1);
int function = get_safe_SVAL(param,tpscnt,p,4,-1);
ZERO_STRUCT(handle);
- status = rpc_pipe_open_interface(conn,
- &ndr_table_spoolss.syntax_id,
+ status = rpc_pipe_open_interface(mem_ctx,
+ &ndr_table_spoolss,
conn->session_info,
conn->sconn->remote_address,
+ conn->sconn->local_address,
conn->sconn->msg_ctx,
&cli);
if (!NT_STATUS_IS_OK(status)) {
p = *rdata;
p2 = p + struct_len;
- status = rpc_pipe_open_interface(mem_ctx, &ndr_table_srvsvc.syntax_id,
+ status = rpc_pipe_open_interface(mem_ctx, &ndr_table_srvsvc,
conn->session_info,
conn->sconn->remote_address,
+ conn->sconn->local_address,
conn->sconn->msg_ctx,
&cli);
if (!NT_STATUS_IS_OK(status)) {
}
if (info.info101 == NULL) {
- errcode = W_ERROR_V(WERR_INVALID_PARAM);
+ errcode = W_ERROR_V(WERR_INVALID_PARAMETER);
goto out;
}
if (uLevel != 20) {
- srvstr_push(NULL, 0, p, info.info101->server_name, 16,
- STR_ASCII|STR_UPPER|STR_TERMINATE);
+ size_t len = 0;
+ status = srvstr_push(NULL, 0, p, info.info101->server_name, 16,
+ STR_ASCII|STR_UPPER|STR_TERMINATE, &len);
+ if (!NT_STATUS_IS_OK(status)) {
+ errcode = W_ERROR_V(ntstatus_to_werror(status));
+ goto out;
+ }
}
p += 16;
if (uLevel > 0) {
SIVAL(p,0,PTR_DIFF(p2,*rdata)); /* host name */
strlcpy(p2,get_local_machine_name(),PTR_DIFF(endp,p2));
- strupper_m(p2);
+ if (!strupper_m(p2)) {
+ return false;
+ }
p2 = skip_string(*rdata,*rdata_len,p2);
if (!p2) {
return False;
SIVAL(p,0,PTR_DIFF(p2,*rdata)); /* login domain */
strlcpy(p2,lp_workgroup(),PTR_DIFF(endp,p2));
- strupper_m(p2);
+ if (!strupper_m(p2)) {
+ return false;
+ }
p2 = skip_string(*rdata,*rdata_len,p2);
if (!p2) {
return False;
struct lsa_String names;
struct samr_Ids rids;
struct samr_Ids types;
- int errcode = W_ERROR_V(WERR_USER_NOT_FOUND);
+ int errcode = W_ERROR_V(WERR_NERR_USERNOTFOUND);
uint32_t rid;
union samr_UserInfo *info;
struct dcerpc_binding_handle *b = NULL;
ZERO_STRUCT(domain_handle);
ZERO_STRUCT(user_handle);
- status = rpc_pipe_open_interface(mem_ctx, &ndr_table_samr.syntax_id,
+ status = rpc_pipe_open_interface(mem_ctx, &ndr_table_samr,
conn->session_info,
conn->sconn->remote_address,
+ conn->sconn->local_address,
conn->sconn->msg_ctx,
&cli);
if (!NT_STATUS_IS_OK(status)) {
goto out;
}
if (rids.count != types.count) {
- errcode = W_ERROR_V(WERR_INVALID_PARAM);
+ errcode = W_ERROR_V(WERR_INVALID_PARAMETER);
goto out;
}
if (types.ids[0] != SID_NAME_USER) {
- errcode = W_ERROR_V(WERR_INVALID_PARAM);
+ errcode = W_ERROR_V(WERR_INVALID_PARAMETER);
goto out;
}
fstring mypath;
fstrcpy(mypath,"\\\\");
fstrcat(mypath,get_local_machine_name());
- strupper_m(mypath);
+ if (!strupper_m(mypath)) {
+ return false;
+ }
PACKS(&desc,"z",mypath); /* computer */
}
char *p = skip_string(param,tpscnt,str2);
int uLevel;
fstring sharename;
- uint32 jobid;
+ uint32_t jobid;
struct pack_desc desc;
char *tmpdata=NULL;
ZERO_STRUCT(handle);
- status = rpc_pipe_open_interface(conn,
- &ndr_table_spoolss.syntax_id,
+ status = rpc_pipe_open_interface(mem_ctx,
+ &ndr_table_spoolss,
conn->session_info,
conn->sconn->remote_address,
+ conn->sconn->local_address,
conn->sconn->msg_ctx,
&cli);
if (!NT_STATUS_IS_OK(status)) {
ZERO_STRUCT(handle);
- status = rpc_pipe_open_interface(conn,
- &ndr_table_spoolss.syntax_id,
+ status = rpc_pipe_open_interface(mem_ctx,
+ &ndr_table_spoolss,
conn->session_info,
conn->sconn->remote_address,
+ conn->sconn->local_address,
conn->sconn->msg_ctx,
&cli);
if (!NT_STATUS_IS_OK(status)) {
name,
NULL,
devmode_ctr,
- SEC_FLAG_MAXIMUM_ALLOWED,
+ PRINTER_ACCESS_USE,
&handle,
&werr);
if (!NT_STATUS_IS_OK(status)) {
strncpy(buf, info2->printername, sizeof(buf)-1);
buf[sizeof(buf)-1] = 0;
- strupper_m(buf);
+ (void)strupper_m(buf);
if (uLevel <= 1) {
PACKS(desc,"B9",buf); /* szName */
ZERO_STRUCT(handle);
- status = rpc_pipe_open_interface(conn,
- &ndr_table_spoolss.syntax_id,
+ status = rpc_pipe_open_interface(mem_ctx,
+ &ndr_table_spoolss,
conn->session_info,
conn->sconn->remote_address,
+ conn->sconn->local_address,
conn->sconn->msg_ctx,
&cli);
if (!NT_STATUS_IS_OK(status)) {
PrinterName,
NULL,
devmode_ctr,
- SEC_FLAG_MAXIMUM_ALLOWED,
+ PRINTER_ACCESS_USE,
&handle,
&werr);
if (!NT_STATUS_IS_OK(status)) {
queuecnt = 0;
- status = rpc_pipe_open_interface(conn,
- &ndr_table_spoolss.syntax_id,
+ status = rpc_pipe_open_interface(mem_ctx,
+ &ndr_table_spoolss,
conn->session_info,
conn->sconn->remote_address,
+ conn->sconn->local_address,
conn->sconn->msg_ctx,
&cli);
if (!NT_STATUS_IS_OK(status)) {
return False;
}
- status = rpc_pipe_open_interface(conn,
- &ndr_table_srvsvc.syntax_id,
+ status = rpc_pipe_open_interface(mem_ctx,
+ &ndr_table_srvsvc,
conn->session_info,
conn->sconn->remote_address,
+ conn->sconn->local_address,
conn->sconn->msg_ctx,
&cli);
if (!NT_STATUS_IS_OK(status)) {
info_ctr.level = 1;
info_ctr.ctr.ctr1 = talloc_zero(talloc_tos(), struct srvsvc_NetSessCtr1);
if (info_ctr.ctr.ctr1 == NULL) {
- desc.errcode = W_ERROR_V(WERR_NOMEM);
+ desc.errcode = W_ERROR_V(WERR_NOT_ENOUGH_MEMORY);
goto out;
}
int,int,char **,char **,int *,int *);
bool auth_user; /* Deny anonymous access? */
} api_commands[] = {
- {"RNetShareEnum", RAP_WshareEnum, api_RNetShareEnum, True},
- {"RNetShareGetInfo", RAP_WshareGetInfo, api_RNetShareGetInfo},
- {"RNetShareAdd", RAP_WshareAdd, api_RNetShareAdd},
- {"RNetSessionEnum", RAP_WsessionEnum, api_RNetSessionEnum, True},
- {"RNetServerGetInfo", RAP_WserverGetInfo, api_RNetServerGetInfo},
- {"RNetGroupEnum", RAP_WGroupEnum, api_RNetGroupEnum, True},
- {"RNetGroupGetUsers", RAP_WGroupGetUsers, api_RNetGroupGetUsers, True},
- {"RNetUserEnum", RAP_WUserEnum, api_RNetUserEnum, True},
- {"RNetUserGetInfo", RAP_WUserGetInfo, api_RNetUserGetInfo},
- {"NetUserGetGroups", RAP_WUserGetGroups, api_NetUserGetGroups},
- {"NetWkstaGetInfo", RAP_WWkstaGetInfo, api_NetWkstaGetInfo},
- {"DosPrintQEnum", RAP_WPrintQEnum, api_DosPrintQEnum, True},
- {"DosPrintQGetInfo", RAP_WPrintQGetInfo, api_DosPrintQGetInfo},
- {"WPrintQueuePause", RAP_WPrintQPause, api_WPrintQueueCtrl},
- {"WPrintQueueResume", RAP_WPrintQContinue, api_WPrintQueueCtrl},
- {"WPrintJobEnumerate",RAP_WPrintJobEnum, api_WPrintJobEnumerate},
- {"WPrintJobGetInfo", RAP_WPrintJobGetInfo, api_WPrintJobGetInfo},
- {"RDosPrintJobDel", RAP_WPrintJobDel, api_RDosPrintJobDel},
- {"RDosPrintJobPause", RAP_WPrintJobPause, api_RDosPrintJobDel},
- {"RDosPrintJobResume",RAP_WPrintJobContinue, api_RDosPrintJobDel},
- {"WPrintDestEnum", RAP_WPrintDestEnum, api_WPrintDestEnum},
- {"WPrintDestGetInfo", RAP_WPrintDestGetInfo, api_WPrintDestGetInfo},
- {"NetRemoteTOD", RAP_NetRemoteTOD, api_NetRemoteTOD},
- {"WPrintQueuePurge", RAP_WPrintQPurge, api_WPrintQueueCtrl},
- {"NetServerEnum2", RAP_NetServerEnum2, api_RNetServerEnum2}, /* anon OK */
- {"NetServerEnum3", RAP_NetServerEnum3, api_RNetServerEnum3}, /* anon OK */
- {"WAccessGetUserPerms",RAP_WAccessGetUserPerms,api_WAccessGetUserPerms},
- {"SetUserPassword", RAP_WUserPasswordSet2, api_SetUserPassword},
- {"WWkstaUserLogon", RAP_WWkstaUserLogon, api_WWkstaUserLogon},
- {"PrintJobInfo", RAP_WPrintJobSetInfo, api_PrintJobInfo},
- {"WPrintDriverEnum", RAP_WPrintDriverEnum, api_WPrintDriverEnum},
- {"WPrintQProcEnum", RAP_WPrintQProcessorEnum,api_WPrintQProcEnum},
- {"WPrintPortEnum", RAP_WPrintPortEnum, api_WPrintPortEnum},
- {"SamOEMChangePassword",RAP_SamOEMChgPasswordUser2_P,api_SamOEMChangePassword}, /* anon OK */
- {NULL, -1, api_Unsupported}
- /* The following RAP calls are not implemented by Samba:
-
- RAP_WFileEnum2 - anon not OK
- */
+ {
+ .name = "RNetShareEnum",
+ .id = RAP_WshareEnum,
+ .fn = api_RNetShareEnum,
+ .auth_user = true,
+ },
+ {
+ .name = "RNetShareGetInfo",
+ .id = RAP_WshareGetInfo,
+ .fn = api_RNetShareGetInfo
+ },
+ {
+ .name = "RNetShareAdd",
+ .id = RAP_WshareAdd,
+ .fn = api_RNetShareAdd
+ },
+ {
+ .name = "RNetSessionEnum",
+ .id = RAP_WsessionEnum,
+ .fn = api_RNetSessionEnum,
+ .auth_user = true,
+ },
+ {
+ .name = "RNetServerGetInfo",
+ .id = RAP_WserverGetInfo,
+ .fn = api_RNetServerGetInfo
+ },
+ {
+ .name = "RNetGroupEnum",
+ .id = RAP_WGroupEnum,
+ .fn = api_RNetGroupEnum, True
+ },
+ {
+ .name = "RNetGroupGetUsers",
+ .id = RAP_WGroupGetUsers,
+ .fn = api_RNetGroupGetUsers,
+ .auth_user = true},
+ {
+ .name = "RNetUserEnum",
+ .id = RAP_WUserEnum,
+ .fn = api_RNetUserEnum,
+ .auth_user = true,
+ },
+ {
+ .name = "RNetUserGetInfo",
+ .id = RAP_WUserGetInfo,
+ .fn = api_RNetUserGetInfo
+ },
+ {
+ .name = "NetUserGetGroups",
+ .id = RAP_WUserGetGroups,
+ .fn = api_NetUserGetGroups
+ },
+ {
+ .name = "NetWkstaGetInfo",
+ .id = RAP_WWkstaGetInfo,
+ .fn = api_NetWkstaGetInfo
+ },
+ {
+ .name = "DosPrintQEnum",
+ .id = RAP_WPrintQEnum,
+ .fn = api_DosPrintQEnum,
+ .auth_user = true,
+ },
+ {
+ .name = "DosPrintQGetInfo",
+ .id = RAP_WPrintQGetInfo,
+ .fn = api_DosPrintQGetInfo
+ },
+ {
+ .name = "WPrintQueuePause",
+ .id = RAP_WPrintQPause,
+ .fn = api_WPrintQueueCtrl
+ },
+ {
+ .name = "WPrintQueueResume",
+ .id = RAP_WPrintQContinue,
+ .fn = api_WPrintQueueCtrl
+ },
+ {
+ .name = "WPrintJobEnumerate",
+ .id = RAP_WPrintJobEnum,
+ .fn = api_WPrintJobEnumerate
+ },
+ {
+ .name = "WPrintJobGetInfo",
+ .id = RAP_WPrintJobGetInfo,
+ .fn = api_WPrintJobGetInfo
+ },
+ {
+ .name = "RDosPrintJobDel",
+ .id = RAP_WPrintJobDel,
+ .fn = api_RDosPrintJobDel
+ },
+ {
+ .name = "RDosPrintJobPause",
+ .id = RAP_WPrintJobPause,
+ .fn = api_RDosPrintJobDel
+ },
+ {
+ .name = "RDosPrintJobResume",
+ .id = RAP_WPrintJobContinue,
+ .fn = api_RDosPrintJobDel
+ },
+ {
+ .name = "WPrintDestEnum",
+ .id = RAP_WPrintDestEnum,
+ .fn = api_WPrintDestEnum
+ },
+ {
+ .name = "WPrintDestGetInfo",
+ .id = RAP_WPrintDestGetInfo,
+ .fn = api_WPrintDestGetInfo
+ },
+ {
+ .name = "NetRemoteTOD",
+ .id = RAP_NetRemoteTOD,
+ .fn = api_NetRemoteTOD
+ },
+ {
+ .name = "WPrintQueuePurge",
+ .id = RAP_WPrintQPurge,
+ .fn = api_WPrintQueueCtrl
+ },
+ {
+ .name = "NetServerEnum2",
+ .id = RAP_NetServerEnum2,
+ .fn = api_RNetServerEnum2
+ }, /* anon OK */
+ {
+ .name = "NetServerEnum3",
+ .id = RAP_NetServerEnum3,
+ .fn = api_RNetServerEnum3
+ }, /* anon OK */
+ {
+ .name = "WAccessGetUserPerms",
+ .id = RAP_WAccessGetUserPerms,
+ .fn = api_WAccessGetUserPerms
+ },
+ {
+ .name = "WWkstaUserLogon",
+ .id = RAP_WWkstaUserLogon,
+ .fn = api_WWkstaUserLogon
+ },
+ {
+ .name = "PrintJobInfo",
+ .id = RAP_WPrintJobSetInfo,
+ .fn = api_PrintJobInfo
+ },
+ {
+ .name = "WPrintDriverEnum",
+ .id = RAP_WPrintDriverEnum,
+ .fn = api_WPrintDriverEnum
+ },
+ {
+ .name = "WPrintQProcEnum",
+ .id = RAP_WPrintQProcessorEnum,
+ .fn = api_WPrintQProcEnum
+ },
+ {
+ .name = "WPrintPortEnum",
+ .id = RAP_WPrintPortEnum,
+ .fn = api_WPrintPortEnum
+ },
+ {
+ .name = "SamOEMChangePassword",
+ .id = RAP_SamOEMChgPasswordUser2_P,
+ .fn = api_SamOEMChangePassword
+ }, /* anon OK */
+ {
+ .name = NULL,
+ .id = -1,
+ .fn = api_Unsupported}
+ /*
+ * The following RAP calls are not implemented by Samba:
+ * RAP_WFileEnum2 - anon not OK
+ */
};