mirror of
https://github.com/samba-team/samba.git
synced 2024-12-25 23:21:54 +03:00
Use pidl for _srvsvc_NetSrvGetInfo().
Guenther
This commit is contained in:
parent
3c0a3f8de7
commit
34caa41fa6
@ -304,7 +304,8 @@ RPC_PARSE_OBJ1 = $(RPC_PARSE_OBJ0) rpc_parse/parse_sec.o
|
||||
RPC_PARSE_OBJ2 = rpc_parse/parse_rpc.o rpc_parse/parse_srv.o
|
||||
RPC_PARSE_OBJ2 = rpc_parse/parse_rpc.o rpc_parse/parse_srv.o \
|
||||
rpc_client/init_netlogon.o \
|
||||
rpc_client/init_lsa.o
|
||||
rpc_client/init_lsa.o \
|
||||
rpc_client/init_srvsvc.o
|
||||
|
||||
LIBREPLACE_OBJ = @LIBREPLACE_OBJS@
|
||||
|
||||
|
86
source/rpc_client/init_srvsvc.c
Normal file
86
source/rpc_client/init_srvsvc.c
Normal file
@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Unix SMB/CIFS implementation.
|
||||
* RPC Pipe client / server routines
|
||||
* Copyright (C) Guenther Deschner 2008.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
|
||||
/*******************************************************************
|
||||
inits a srvsvc_NetSrvInfo102 structure
|
||||
********************************************************************/
|
||||
|
||||
void init_srvsvc_NetSrvInfo102(struct srvsvc_NetSrvInfo102 *r,
|
||||
enum srvsvc_PlatformId platform_id,
|
||||
const char *server_name,
|
||||
uint32_t version_major,
|
||||
uint32_t version_minor,
|
||||
uint32_t server_type,
|
||||
const char *comment,
|
||||
uint32_t users,
|
||||
uint32_t disc,
|
||||
uint32_t hidden,
|
||||
uint32_t announce,
|
||||
uint32_t anndelta,
|
||||
uint32_t licenses,
|
||||
const char *userpath)
|
||||
{
|
||||
r->platform_id = platform_id;
|
||||
r->server_name = server_name;
|
||||
r->version_major = version_major;
|
||||
r->version_minor = version_minor;
|
||||
r->server_type = server_type;
|
||||
r->comment = comment;
|
||||
r->users = users;
|
||||
r->disc = disc;
|
||||
r->hidden = hidden;
|
||||
r->announce = announce;
|
||||
r->anndelta = anndelta;
|
||||
r->licenses = licenses;
|
||||
r->userpath = userpath;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
inits a srvsvc_NetSrvInfo101 structure
|
||||
********************************************************************/
|
||||
|
||||
void init_srvsvc_NetSrvInfo101(struct srvsvc_NetSrvInfo101 *r,
|
||||
enum srvsvc_PlatformId platform_id,
|
||||
const char *server_name,
|
||||
uint32_t version_major,
|
||||
uint32_t version_minor,
|
||||
uint32_t server_type,
|
||||
const char *comment)
|
||||
{
|
||||
r->platform_id = platform_id;
|
||||
r->server_name = server_name;
|
||||
r->version_major = version_major;
|
||||
r->version_minor = version_minor;
|
||||
r->server_type = server_type;
|
||||
r->comment = comment;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
inits a srvsvc_NetSrvInfo100 structure
|
||||
********************************************************************/
|
||||
|
||||
void init_srvsvc_NetSrvInfo100(struct srvsvc_NetSrvInfo100 *r,
|
||||
enum srvsvc_PlatformId platform_id,
|
||||
const char *server_name)
|
||||
{
|
||||
r->platform_id = platform_id;
|
||||
r->server_name = server_name;
|
||||
}
|
@ -52,25 +52,7 @@ static bool proxy_srvsvc_call(pipes_struct *p, uint8 opnum)
|
||||
|
||||
static bool api_srv_net_srv_get_info(pipes_struct *p)
|
||||
{
|
||||
SRV_Q_NET_SRV_GET_INFO q_u;
|
||||
SRV_R_NET_SRV_GET_INFO r_u;
|
||||
prs_struct *data = &p->in_data.data;
|
||||
prs_struct *rdata = &p->out_data.rdata;
|
||||
|
||||
ZERO_STRUCT(q_u);
|
||||
ZERO_STRUCT(r_u);
|
||||
|
||||
/* grab the net server get info */
|
||||
if (!srv_io_q_net_srv_get_info("", &q_u, data, 0))
|
||||
return False;
|
||||
|
||||
r_u.status = _srv_net_srv_get_info(p, &q_u, &r_u);
|
||||
|
||||
/* store the response in the SMB stream */
|
||||
if (!srv_io_r_net_srv_get_info("", &r_u, rdata, 0))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
return proxy_srvsvc_call(p, NDR_SRVSVC_NETSRVGETINFO);
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
|
@ -1238,67 +1238,93 @@ WERROR _srv_net_file_enum(pipes_struct *p, SRV_Q_NET_FILE_ENUM *q_u, SRV_R_NET_F
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
net server get info
|
||||
_srvsvc_NetSrvGetInfo
|
||||
********************************************************************/
|
||||
|
||||
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)
|
||||
WERROR _srvsvc_NetSrvGetInfo(pipes_struct *p,
|
||||
struct srvsvc_NetSrvGetInfo *r)
|
||||
{
|
||||
WERROR status = WERR_OK;
|
||||
SRV_INFO_CTR *ctr = TALLOC_P(p->mem_ctx, SRV_INFO_CTR);
|
||||
|
||||
if (!ctr)
|
||||
return WERR_NOMEM;
|
||||
|
||||
ZERO_STRUCTP(ctr);
|
||||
|
||||
DEBUG(5,("srv_net_srv_get_info: %d\n", __LINE__));
|
||||
DEBUG(5,("_srvsvc_NetSrvGetInfo: %d\n", __LINE__));
|
||||
|
||||
if (!pipe_access_check(p)) {
|
||||
DEBUG(3, ("access denied to srv_net_srv_get_info\n"));
|
||||
DEBUG(3, ("access denied to _srvsvc_NetSrvGetInfo\n"));
|
||||
return WERR_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
switch (q_u->switch_value) {
|
||||
switch (r->in.level) {
|
||||
|
||||
/* Technically level 102 should only be available to
|
||||
Administrators but there isn't anything super-secret
|
||||
here, as most of it is made up. */
|
||||
|
||||
case 102:
|
||||
init_srv_info_102(&ctr->srv.sv102,
|
||||
500, global_myname(),
|
||||
string_truncate(lp_serverstring(), MAX_SERVER_STRING_LENGTH),
|
||||
lp_major_announce_version(), lp_minor_announce_version(),
|
||||
lp_default_server_announce(),
|
||||
0xffffffff, /* users */
|
||||
0xf, /* disc */
|
||||
0, /* hidden */
|
||||
240, /* announce */
|
||||
3000, /* announce delta */
|
||||
100000, /* licenses */
|
||||
"c:\\"); /* user path */
|
||||
case 102: {
|
||||
struct srvsvc_NetSrvInfo102 *info102;
|
||||
|
||||
info102 = TALLOC_P(p->mem_ctx, struct srvsvc_NetSrvInfo102);
|
||||
if (!info102) {
|
||||
return WERR_NOMEM;
|
||||
}
|
||||
|
||||
init_srvsvc_NetSrvInfo102(info102,
|
||||
PLATFORM_ID_NT,
|
||||
global_myname(),
|
||||
lp_major_announce_version(),
|
||||
lp_minor_announce_version(),
|
||||
lp_default_server_announce(),
|
||||
string_truncate(lp_serverstring(), MAX_SERVER_STRING_LENGTH),
|
||||
0xffffffff, /* users */
|
||||
0xf, /* disc */
|
||||
0, /* hidden */
|
||||
240, /* announce */
|
||||
3000, /* announce delta */
|
||||
100000, /* licenses */
|
||||
"c:\\"); /* user path */
|
||||
r->out.info->info102 = info102;
|
||||
break;
|
||||
case 101:
|
||||
init_srv_info_101(&ctr->srv.sv101,
|
||||
500, global_myname(),
|
||||
lp_major_announce_version(), lp_minor_announce_version(),
|
||||
lp_default_server_announce(),
|
||||
string_truncate(lp_serverstring(), MAX_SERVER_STRING_LENGTH));
|
||||
}
|
||||
case 101: {
|
||||
struct srvsvc_NetSrvInfo101 *info101;
|
||||
|
||||
info101 = TALLOC_P(p->mem_ctx, struct srvsvc_NetSrvInfo101);
|
||||
if (!info101) {
|
||||
return WERR_NOMEM;
|
||||
}
|
||||
|
||||
init_srvsvc_NetSrvInfo101(info101,
|
||||
PLATFORM_ID_NT,
|
||||
global_myname(),
|
||||
lp_major_announce_version(),
|
||||
lp_minor_announce_version(),
|
||||
lp_default_server_announce(),
|
||||
string_truncate(lp_serverstring(), MAX_SERVER_STRING_LENGTH));
|
||||
r->out.info->info101 = info101;
|
||||
break;
|
||||
case 100:
|
||||
init_srv_info_100(&ctr->srv.sv100, 500, global_myname());
|
||||
}
|
||||
case 100: {
|
||||
struct srvsvc_NetSrvInfo100 *info100;
|
||||
|
||||
info100 = TALLOC_P(p->mem_ctx, struct srvsvc_NetSrvInfo100);
|
||||
if (!info100) {
|
||||
return WERR_NOMEM;
|
||||
}
|
||||
|
||||
init_srvsvc_NetSrvInfo100(info100,
|
||||
PLATFORM_ID_NT,
|
||||
global_myname());
|
||||
r->out.info->info100 = info100;
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
status = WERR_UNKNOWN_LEVEL;
|
||||
break;
|
||||
}
|
||||
|
||||
/* set up the net server get info structure */
|
||||
init_srv_r_net_srv_get_info(r_u, q_u->switch_value, ctr, status);
|
||||
DEBUG(5,("_srvsvc_NetSrvGetInfo: %d\n", __LINE__));
|
||||
|
||||
DEBUG(5,("srv_net_srv_get_info: %d\n", __LINE__));
|
||||
|
||||
return r_u->status;
|
||||
return status;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
@ -2548,12 +2574,6 @@ WERROR _srvsvc_NetShareCheck(pipes_struct *p, struct srvsvc_NetShareCheck *r)
|
||||
return WERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
WERROR _srvsvc_NetSrvGetInfo(pipes_struct *p, struct srvsvc_NetSrvGetInfo *r)
|
||||
{
|
||||
p->rng_fault_state = True;
|
||||
return WERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
WERROR _srvsvc_NetSrvSetInfo(pipes_struct *p, struct srvsvc_NetSrvSetInfo *r)
|
||||
{
|
||||
p->rng_fault_state = True;
|
||||
|
Loading…
Reference in New Issue
Block a user