summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/auth/auth_domain.c2
-rw-r--r--source3/include/smb.h11
-rw-r--r--source3/nsswitch/winbindd_cm.c2
-rw-r--r--source3/rpc_client/cli_lsarpc.c2
-rw-r--r--source3/rpc_client/cli_pipe.c107
-rw-r--r--source3/rpc_parse/parse_rpc.c35
-rw-r--r--source3/rpc_server/srv_pipe.c41
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c2
-rw-r--r--source3/rpcclient/cmd_dfs.c10
-rw-r--r--source3/rpcclient/cmd_lsarpc.c29
-rw-r--r--source3/rpcclient/cmd_netlogon.c10
-rw-r--r--source3/rpcclient/cmd_reg.c20
-rw-r--r--source3/rpcclient/cmd_samr.c34
-rw-r--r--source3/rpcclient/cmd_spoolss.c48
-rw-r--r--source3/rpcclient/cmd_srvsvc.c8
-rw-r--r--source3/rpcclient/cmd_wkssvc.c2
-rw-r--r--source3/rpcclient/rpcclient.c25
-rw-r--r--source3/rpcclient/rpcclient.h2
-rw-r--r--source3/rpcclient/samsync.c2
-rw-r--r--source3/smbd/change_trust_pw.c2
-rw-r--r--source3/utils/net_rpc.c54
-rw-r--r--source3/utils/net_rpc_join.c6
-rw-r--r--source3/utils/net_rpc_samsync.c4
-rw-r--r--source3/utils/smbcacls.c2
24 files changed, 283 insertions, 177 deletions
diff --git a/source3/auth/auth_domain.c b/source3/auth/auth_domain.c
index 2e51a85281..59b9233a2d 100644
--- a/source3/auth/auth_domain.c
+++ b/source3/auth/auth_domain.c
@@ -190,7 +190,7 @@ static NTSTATUS connect_to_domain_password_server(struct cli_state **cli,
* into account also. This patch from "Bjart Kvarme" <bjart.kvarme@usit.uio.no>.
*/
- if(cli_nt_session_open(*cli, PIPE_NETLOGON) == False) {
+ if(cli_nt_session_open(*cli, PI_NETLOGON) == False) {
DEBUG(0,("connect_to_domain_password_server: unable to open the domain client session to \
machine %s. Error was : %s.\n", remote_machine, cli_errstr(*cli)));
cli_nt_session_close(*cli);
diff --git a/source3/include/smb.h b/source3/include/smb.h
index f58e3adf54..5bf79b75fe 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -187,6 +187,17 @@ typedef smb_ucs2_t wfstring[FSTRING_LEN];
#define PIPE_SPOOLSS "\\PIPE\\spoolss"
#define PIPE_NETDFS "\\PIPE\\netdfs"
+#define PI_LSARPC 0
+#define PI_LSARPC_V2 1
+#define PI_SAMR 2
+#define PI_NETLOGON 3
+#define PI_SRVSVC 4
+#define PI_WKSSVC 5
+#define PI_WINREG 6
+#define PI_SPOOLSS 7
+#define PI_NETDFS 8
+#define PI_MAX_PIPES 9
+
/* 64 bit time (100usec) since ????? - cifs6.txt, section 3.5, page 30 */
typedef struct nttime_info
{
diff --git a/source3/nsswitch/winbindd_cm.c b/source3/nsswitch/winbindd_cm.c
index 0de6c9022b..313b9da1bb 100644
--- a/source3/nsswitch/winbindd_cm.c
+++ b/source3/nsswitch/winbindd_cm.c
@@ -460,7 +460,7 @@ static NTSTATUS cm_open_connection(const char *domain,const char *pipe_name,
return result;
}
- if (!cli_nt_session_open (new_conn->cli, pipe_name)) {
+ if (!cli_nt_session_open (new_conn->cli, get_pipe_index(pipe_name))) {
result = NT_STATUS_PIPE_NOT_AVAILABLE;
add_failed_connection_entry(new_conn, result);
cli_shutdown(new_conn->cli);
diff --git a/source3/rpc_client/cli_lsarpc.c b/source3/rpc_client/cli_lsarpc.c
index 5555f4bd52..6d1d56ee84 100644
--- a/source3/rpc_client/cli_lsarpc.c
+++ b/source3/rpc_client/cli_lsarpc.c
@@ -1224,7 +1224,7 @@ Error was : %s.\n", remote_machine, cli_errstr(&cli) ));
/* Fetch domain sid */
- if (!cli_nt_session_open(&cli, PIPE_LSARPC)) {
+ if (!cli_nt_session_open(&cli, PI_LSARPC)) {
DEBUG(0, ("fetch_domain_sid: Error connecting to SAM pipe\n"));
goto done;
}
diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c
index 0416ed3b9b..b6b58d2237 100644
--- a/source3/rpc_client/cli_pipe.c
+++ b/source3/rpc_client/cli_pipe.c
@@ -952,6 +952,8 @@ static BOOL rpc_pipe_set_hnd_state(struct cli_state *cli, const char *pipe_name,
return state_set;
}
+#if 0 /* JERRY */
+
/****************************************************************************
check the rpc bind acknowledge response
****************************************************************************/
@@ -982,32 +984,73 @@ static BOOL valid_pipe_name(const char *pipe_name, RPC_IFACE *abstract, RPC_IFAC
return False;
}
+#endif
+
+/****************************************************************************
+ check the rpc bind acknowledge response
+****************************************************************************/
+
+int get_pipe_index( const char *pipe_name )
+{
+ int pipe_idx = 0;
+
+ while (pipe_names[pipe_idx].client_pipe != NULL) {
+ if (strequal(pipe_name, pipe_names[pipe_idx].client_pipe ))
+ return pipe_idx;
+ pipe_idx++;
+ };
+
+ return -1;
+}
+
/****************************************************************************
check the rpc bind acknowledge response
****************************************************************************/
-static BOOL check_bind_response(RPC_HDR_BA *hdr_ba, const char *pipe_name, RPC_IFACE *transfer)
+static BOOL valid_pipe_name_by_idx(const int pipe_idx, RPC_IFACE *abstract, RPC_IFACE *transfer)
+{
+ if ( pipe_idx >= PI_MAX_PIPES ) {
+ DEBUG(0,("valid_pipe_name_by_idx: Programmer error! Invalid pipe index [%d]\n",
+ pipe_idx));
+ return False;
+ }
+
+ DEBUG(5,("Bind Abstract Syntax: "));
+ dump_data(5, (char*)&(pipe_names[pipe_idx].abstr_syntax),
+ sizeof(pipe_names[pipe_idx].abstr_syntax));
+ DEBUG(5,("Bind Transfer Syntax: "));
+ dump_data(5, (char*)&(pipe_names[pipe_idx].trans_syntax),
+ sizeof(pipe_names[pipe_idx].trans_syntax));
+
+ /* copy the required syntaxes out so we can do the right bind */
+
+ *transfer = pipe_names[pipe_idx].trans_syntax;
+ *abstract = pipe_names[pipe_idx].abstr_syntax;
+
+ return True;
+}
+
+/****************************************************************************
+ check the rpc bind acknowledge response
+****************************************************************************/
+
+static BOOL check_bind_response(RPC_HDR_BA *hdr_ba, const int pipe_idx, RPC_IFACE *transfer)
{
int i = 0;
- while ((pipe_names[i].client_pipe != NULL) && hdr_ba->addr.len > 0) {
- if ((strequal(pipe_name, pipe_names[i].client_pipe ))) {
- if (strequal(hdr_ba->addr.str, pipe_names[i].server_pipe )) {
- DEBUG(5,("bind_rpc_pipe: server pipe_name found: %s\n",
- pipe_names[i].server_pipe ));
- break;
- } else {
- DEBUG(4,("bind_rpc_pipe: pipe_name %s != expected pipe %s. oh well!\n",
- pipe_names[i].server_pipe ,
- hdr_ba->addr.str));
- break;
- }
- } else {
- i++;
- }
+ if ( hdr_ba->addr.len <= 0)
+ return False;
+
+ if ( !strequal(hdr_ba->addr.str, pipe_names[pipe_idx].server_pipe ))
+ {
+ DEBUG(4,("bind_rpc_pipe: pipe_name %s != expected pipe %s. oh well!\n",
+ pipe_names[i].server_pipe ,hdr_ba->addr.str));
+ return False;
}
+
+ DEBUG(5,("bind_rpc_pipe: server pipe_name found: %s\n", pipe_names[i].server_pipe ));
- if (pipe_names[i].server_pipe == NULL) {
+ if (pipe_names[pipe_idx].server_pipe == NULL) {
DEBUG(2,("bind_rpc_pipe: pipe name %s unsupported\n", hdr_ba->addr.str));
return False;
}
@@ -1120,7 +1163,7 @@ static BOOL rpc_send_auth_reply(struct cli_state *cli, prs_struct *rdata, uint32
Do an rpc bind.
****************************************************************************/
-BOOL rpc_pipe_bind(struct cli_state *cli, const char *pipe_name, char *my_name)
+BOOL rpc_pipe_bind(struct cli_state *cli, const int pipe_idx, char *my_name)
{
RPC_IFACE abstract;
RPC_IFACE transfer;
@@ -1130,9 +1173,12 @@ BOOL rpc_pipe_bind(struct cli_state *cli, const char *pipe_name, char *my_name)
uint32 rpc_call_id;
char buffer[MAX_PDU_FRAG_LEN];
- DEBUG(5,("Bind RPC Pipe[%x]: %s\n", cli->nt_pipe_fnum, pipe_name));
+ if ( (pipe_idx < 0) || (pipe_idx >= PI_MAX_PIPES) )
+ return False;
+
+ DEBUG(5,("Bind RPC Pipe[%x]: %s\n", cli->nt_pipe_fnum, pipe_names[pipe_idx].client_pipe));
- if (!valid_pipe_name(pipe_name, &abstract, &transfer))
+ if (!valid_pipe_name_by_idx(pipe_idx, &abstract, &transfer))
return False;
prs_init(&rpc_out, 0, cli->mem_ctx, MARSHALL);
@@ -1165,7 +1211,7 @@ BOOL rpc_pipe_bind(struct cli_state *cli, const char *pipe_name, char *my_name)
return False;
}
- if(!check_bind_response(&hdr_ba, pipe_name, &transfer)) {
+ if(!check_bind_response(&hdr_ba, pipe_idx, &transfer)) {
DEBUG(0,("rpc_pipe_bind: check_bind_response failed.\n"));
prs_mem_free(&rdata);
return False;
@@ -1205,31 +1251,34 @@ void cli_nt_set_ntlmssp_flgs(struct cli_state *cli, uint32 ntlmssp_flgs)
Open a session.
****************************************************************************/
-BOOL cli_nt_session_open(struct cli_state *cli, const char *pipe_name)
+BOOL cli_nt_session_open(struct cli_state *cli, const int pipe_idx)
{
int fnum;
SMB_ASSERT(cli->nt_pipe_fnum == 0);
+
+ if ( (pipe_idx < 0) || (pipe_idx >= PI_MAX_PIPES) )
+ return False;
if (cli->capabilities & CAP_NT_SMBS) {
- if ((fnum = cli_nt_create(cli, &pipe_name[5], DESIRED_ACCESS_PIPE)) == -1) {
+ if ((fnum = cli_nt_create(cli, &pipe_names[pipe_idx].client_pipe[5], DESIRED_ACCESS_PIPE)) == -1) {
DEBUG(0,("cli_nt_session_open: cli_nt_create failed on pipe %s to machine %s. Error was %s\n",
- &pipe_name[5], cli->desthost, cli_errstr(cli)));
+ &pipe_names[pipe_idx].client_pipe[5], cli->desthost, cli_errstr(cli)));
return False;
}
cli->nt_pipe_fnum = (uint16)fnum;
} else {
- if ((fnum = cli_open(cli, pipe_name, O_CREAT|O_RDWR, DENY_NONE)) == -1) {
+ if ((fnum = cli_open(cli, pipe_names[pipe_idx].client_pipe, O_CREAT|O_RDWR, DENY_NONE)) == -1) {
DEBUG(0,("cli_nt_session_open: cli_open failed on pipe %s to machine %s. Error was %s\n",
- pipe_name, cli->desthost, cli_errstr(cli)));
+ pipe_names[pipe_idx].client_pipe, cli->desthost, cli_errstr(cli)));
return False;
}
cli->nt_pipe_fnum = (uint16)fnum;
/**************** Set Named Pipe State ***************/
- if (!rpc_pipe_set_hnd_state(cli, pipe_name, 0x4300)) {
+ if (!rpc_pipe_set_hnd_state(cli, pipe_names[pipe_idx].client_pipe, 0x4300)) {
DEBUG(0,("cli_nt_session_open: pipe hnd state failed. Error was %s\n",
cli_errstr(cli)));
cli_close(cli, cli->nt_pipe_fnum);
@@ -1239,7 +1288,7 @@ BOOL cli_nt_session_open(struct cli_state *cli, const char *pipe_name)
/******************* bind request on pipe *****************/
- if (!rpc_pipe_bind(cli, pipe_name, global_myname)) {
+ if (!rpc_pipe_bind(cli, pipe_idx, global_myname)) {
DEBUG(0,("cli_nt_session_open: rpc bind failed. Error was %s\n",
cli_errstr(cli)));
cli_close(cli, cli->nt_pipe_fnum);
@@ -1263,7 +1312,7 @@ BOOL cli_nt_session_open(struct cli_state *cli, const char *pipe_name)
strupper(cli->mach_acct);
/* Remember which pipe we're talking to */
- fstrcpy(cli->pipe_name, pipe_name);
+ fstrcpy(cli->pipe_name, pipe_names[pipe_idx].client_pipe);
return True;
}
diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c
index 41e0b4cb5f..590268bed5 100644
--- a/source3/rpc_parse/parse_rpc.c
+++ b/source3/rpc_parse/parse_rpc.c
@@ -75,6 +75,15 @@ interface/version dce/rpc pipe identification
}, 0x00 \
}
+#define SYNT_LSARPC_V0_WIN2K \
+{ \
+ { \
+ 0x3919286a, 0xb10c, 0x11d0, \
+ { 0x9b, 0xa8, 0x00, 0xc0, \
+ 0x4f, 0xd9, 0x2e, 0xf5 } \
+ }, 0x00 \
+}
+
#define SYNT_SAMR_V1 \
{ \
{ \
@@ -129,18 +138,24 @@ interface/version dce/rpc pipe identification
}, 0x03 \
}
+/*
+ * IMPORTANT!! If you update this structure, make sure to
+ * update the index #defines in smb.h.
+ */
+
struct pipe_id_info pipe_names [] =
{
- /* client pipe , abstract syntax , server pipe , transfer syntax */
- { PIPE_LSARPC , SYNT_LSARPC_V0 , PIPE_LSASS , TRANS_SYNT_V2 },
- { PIPE_SAMR , SYNT_SAMR_V1 , PIPE_LSASS , TRANS_SYNT_V2 },
- { PIPE_NETLOGON, SYNT_NETLOGON_V1, PIPE_LSASS , TRANS_SYNT_V2 },
- { PIPE_SRVSVC , SYNT_SRVSVC_V3 , PIPE_NTSVCS , TRANS_SYNT_V2 },
- { PIPE_WKSSVC , SYNT_WKSSVC_V1 , PIPE_NTSVCS , TRANS_SYNT_V2 },
- { PIPE_WINREG , SYNT_WINREG_V1 , PIPE_WINREG , TRANS_SYNT_V2 },
- { PIPE_SPOOLSS , SYNT_SPOOLSS_V1 , PIPE_SPOOLSS , TRANS_SYNT_V2 },
- { PIPE_NETDFS , SYNT_NETDFS_V3 , PIPE_NETDFS , TRANS_SYNT_V2 },
- { NULL , SYNT_NONE_V0 , NULL , SYNT_NONE_V0 }
+ /* client pipe , abstract syntax , server pipe , transfer syntax */
+ { PIPE_LSARPC , SYNT_LSARPC_V0 , PIPE_LSASS , TRANS_SYNT_V2 },
+ { PIPE_LSARPC , SYNT_LSARPC_V0_WIN2K , PIPE_LSASS , TRANS_SYNT_V2 },
+ { PIPE_SAMR , SYNT_SAMR_V1 , PIPE_LSASS , TRANS_SYNT_V2 },
+ { PIPE_NETLOGON, SYNT_NETLOGON_V1 , PIPE_LSASS , TRANS_SYNT_V2 },
+ { PIPE_SRVSVC , SYNT_SRVSVC_V3 , PIPE_NTSVCS , TRANS_SYNT_V2 },
+ { PIPE_WKSSVC , SYNT_WKSSVC_V1 , PIPE_NTSVCS , TRANS_SYNT_V2 },
+ { PIPE_WINREG , SYNT_WINREG_V1 , PIPE_WINREG , TRANS_SYNT_V2 },
+ { PIPE_SPOOLSS , SYNT_SPOOLSS_V1 , PIPE_SPOOLSS , TRANS_SYNT_V2 },
+ { PIPE_NETDFS , SYNT_NETDFS_V3 , PIPE_NETDFS , TRANS_SYNT_V2 },
+ { NULL , SYNT_NONE_V0 , NULL , SYNT_NONE_V0 }
};
/*******************************************************************
diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c
index 1947d5514e..5a935be279 100644
--- a/source3/rpc_server/srv_pipe.c
+++ b/source3/rpc_server/srv_pipe.c
@@ -681,26 +681,49 @@ BOOL check_bind_req(char* pipe_name, RPC_IFACE* abstract,
fstrcpy(pname,"\\PIPE\\");
fstrcat(pname,pipe_name);
- for(i=0;pipe_names[i].client_pipe; i++) {
- if(strequal(pipe_names[i].client_pipe, pname))
+
+#ifndef SUPPORT_NEW_LSARPC_UUID
+
+ /* check for the first pipe matching the name */
+
+ for ( i=0; pipe_names[i].client_pipe; i++ ) {
+ if ( strequal(pipe_names[i].client_pipe, pname) )
+ break;
+ }
+#else
+ /* we have to check all now since win2k introduced a new UUID on the lsaprpc pipe */
+
+ for ( i=0; pipe_names[i].client_pipe; i++ )
+ {
+ if ( strequal(pipe_names[i].client_pipe, pname)
+ && (abstract->version == pipe_names[i].abstr_syntax.version)
+ && (memcmp(&abstract->uuid, &pipe_names[i].abstr_syntax.uuid, sizeof(RPC_UUID)) == 0)
+ && (transfer->version == pipe_names[i].trans_syntax.version)
+ && (memcmp(&transfer->uuid, &pipe_names[i].trans_syntax.uuid, sizeof(RPC_UUID)) == 0) )
+ {
break;
+ }
}
+#endif
if(pipe_names[i].client_pipe == NULL)
return False;
+#ifndef SUPPORT_NEW_LSARPC_UUID
/* check the abstract interface */
- if((abstract->version != pipe_names[i].abstr_syntax.version) ||
- (memcmp(&abstract->uuid, &pipe_names[i].abstr_syntax.uuid,
- sizeof(RPC_UUID)) != 0))
+ if ( (abstract->version != pipe_names[i].abstr_syntax.version)
+ || (memcmp(&abstract->uuid, &pipe_names[i].abstr_syntax.uuid, sizeof(RPC_UUID)) != 0) )
+ {
return False;
+ }
/* check the transfer interface */
- if((transfer->version != pipe_names[i].trans_syntax.version) ||
- (memcmp(&transfer->uuid, &pipe_names[i].trans_syntax.uuid,
- sizeof(RPC_UUID)) != 0))
+ if ( (transfer->version != pipe_names[i].trans_syntax.version)
+ || (memcmp(&transfer->uuid, &pipe_names[i].trans_syntax.uuid, sizeof(RPC_UUID)) != 0) )
+ {
return False;
-
+ }
+#endif
return True;
}
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index 12d6639348..41ef599a3c 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -2375,7 +2375,7 @@ static BOOL spoolss_connect_to_client(struct cli_state *the_cli, char *remote_ma
* Now start the NT Domain stuff :-).
*/
- if(cli_nt_session_open(the_cli, PIPE_SPOOLSS) == False) {
+ if(cli_nt_session_open(the_cli, PI_SPOOLSS) == False) {
DEBUG(0,("connect_to_client: unable to open the domain client session to machine %s. Error was : %s.\n", remote_machine, cli_errstr(the_cli)));
cli_nt_session_close(the_cli);
cli_ulogoff(the_cli);
diff --git a/source3/rpcclient/cmd_dfs.c b/source3/rpcclient/cmd_dfs.c
index 8a3c3e9db3..e3c4b77645 100644
--- a/source3/rpcclient/cmd_dfs.c
+++ b/source3/rpcclient/cmd_dfs.c
@@ -227,11 +227,11 @@ struct cmd_set dfs_commands[] = {
{ "DFS" },
- { "dfsexist", cmd_dfs_exist, PIPE_NETDFS, "Query DFS support", "" },
- { "dfsadd", cmd_dfs_add, PIPE_NETDFS, "Add a DFS share", "" },
- { "dfsremove", cmd_dfs_remove, PIPE_NETDFS, "Remove a DFS share", "" },
- { "dfsgetinfo", cmd_dfs_getinfo, PIPE_NETDFS, "Query DFS share info", "" },
- { "dfsenum", cmd_dfs_enum, PIPE_NETDFS, "Enumerate dfs shares", "" },
+ { "dfsexist", cmd_dfs_exist, PI_NETDFS, "Query DFS support", "" },
+ { "dfsadd", cmd_dfs_add, PI_NETDFS, "Add a DFS share", "" },
+ { "dfsremove", cmd_dfs_remove, PI_NETDFS, "Remove a DFS share", "" },
+ { "dfsgetinfo", cmd_dfs_getinfo, PI_NETDFS, "Query DFS share info", "" },
+ { "dfsenum", cmd_dfs_enum, PI_NETDFS, "Enumerate dfs shares", "" },
{ NULL }
};
diff --git a/source3/rpcclient/cmd_lsarpc.c b/source3/rpcclient/cmd_lsarpc.c
index ed68160658..af5bb2066b 100644
--- a/source3/rpcclient/cmd_lsarpc.c
+++ b/source3/rpcclient/cmd_lsarpc.c
@@ -524,22 +524,31 @@ static NTSTATUS cmd_lsa_query_secobj(struct cli_state *cli,
return result;
}
+
+static NTSTATUS cmd_lsa_dsrole_getprimarydominfo(struct cli_state *cli,
+ TALLOC_CTX *mem_ctx, int argc,
+ char **argv)
+{
+ return NT_STATUS_OK;
+}
+
/* List of commands exported by this module */
struct cmd_set lsarpc_commands[] = {
{ "LSARPC" },
- { "lsaquery", cmd_lsa_query_info_policy, PIPE_LSARPC, "Query info policy", "" },
- { "lookupsids", cmd_lsa_lookup_sids, PIPE_LSARPC, "Convert SIDs to names", "" },
- { "lookupnames", cmd_lsa_lookup_names, PIPE_LSARPC, "Convert names to SIDs", "" },
- { "enumtrust", cmd_lsa_enum_trust_dom, PIPE_LSARPC, "Enumerate trusted domains", "Usage: [preferred max number] [enum context (0)]" },
- { "enumprivs", cmd_lsa_enum_privilege, PIPE_LSARPC, "Enumerate privileges", "" },
- { "getdispname", cmd_lsa_get_dispname, PIPE_LSARPC, "Get the privilege name", "" },
- { "lsaenumsid", cmd_lsa_enum_sids, PIPE_LSARPC, "Enumerate the LSA SIDS", "" },
- { "lsaenumprivsaccount", cmd_lsa_enum_privsaccounts, PIPE_LSARPC, "Enumerate the privileges of an SID", "" },
- { "lsalookupprivvalue", cmd_lsa_lookupprivvalue, PIPE_LSARPC, "Get a privilege value given its name", "" },
- { "lsaquerysecobj", cmd_lsa_query_secobj, PIPE_LSARPC, "Query LSA security object", "" },
+ { "lsaquery", cmd_lsa_query_info_policy, PI_LSARPC, "Query info policy", "" },
+ { "lookupsids", cmd_lsa_lookup_sids, PI_LSARPC, "Convert SIDs to names", "" },
+ { "lookupnames", cmd_lsa_lookup_names, PI_LSARPC, "Convert names to SIDs", "" },
+ { "enumtrust", cmd_lsa_enum_trust_dom, PI_LSARPC, "Enumerate trusted domains", "Usage: [preferred max number] [enum context (0)]" },
+ { "enumprivs", cmd_lsa_enum_privilege, PI_LSARPC, "Enumerate privileges", "" },
+ { "getdispname", cmd_lsa_get_dispname, PI_LSARPC, "Get the privilege name", "" },
+ { "lsaenumsid", cmd_lsa_enum_sids, PI_LSARPC, "Enumerate the LSA SIDS", "" },
+ { "lsaenumprivsaccount", cmd_lsa_enum_privsaccounts, PI_LSARPC, "Enumerate the privileges of an SID", "" },
+ { "lsalookupprivvalue", cmd_lsa_lookupprivvalue, PI_LSARPC, "Get a privilege value given its name", "" },
+ { "lsaquerysecobj", cmd_lsa_query_secobj, PI_LSARPC, "Query LSA security object", "" },
+ { "lsarpcbind", cmd_lsa_dsrole_getprimarydominfo, PI_LSARPC_V2, "Test 2k UUID in rpc bind", "" },
{ NULL }
};
diff --git a/source3/rpcclient/cmd_netlogon.c b/source3/rpcclient/cmd_netlogon.c
index 98ba92e5a3..53a926d52b 100644
--- a/source3/rpcclient/cmd_netlogon.c
+++ b/source3/rpcclient/cmd_netlogon.c
@@ -332,11 +332,11 @@ struct cmd_set netlogon_commands[] = {
{ "NETLOGON" },
- { "logonctrl2", cmd_netlogon_logon_ctrl2, PIPE_NETLOGON, "Logon Control 2", "" },
- { "logonctrl", cmd_netlogon_logon_ctrl, PIPE_NETLOGON, "Logon Control", "" },
- { "samsync", cmd_netlogon_sam_sync, PIPE_NETLOGON, "Sam Synchronisation", "" },
- { "samdeltas", cmd_netlogon_sam_deltas, PIPE_NETLOGON, "Query Sam Deltas", "" },
- { "samlogon", cmd_netlogon_sam_logon, PIPE_NETLOGON, "Sam Logon", "" },
+ { "logonctrl2", cmd_netlogon_logon_ctrl2, PI_NETLOGON, "Logon Control 2", "" },
+ { "logonctrl", cmd_netlogon_logon_ctrl, PI_NETLOGON, "Logon Control", "" },
+ { "samsync", cmd_netlogon_sam_sync, PI_NETLOGON, "Sam Synchronisation", "" },
+ { "samdeltas", cmd_netlogon_sam_deltas, PI_NETLOGON, "Query Sam Deltas", "" },
+ { "samlogon", cmd_netlogon_sam_logon, PI_NETLOGON, "Sam Logon", "" },
{ NULL }
};
diff --git a/source3/rpcclient/cmd_reg.c b/source3/rpcclient/cmd_reg.c
index c089917f9b..e0a3201aa9 100644
--- a/source3/rpcclient/cmd_reg.c
+++ b/source3/rpcclient/cmd_reg.c
@@ -88,7 +88,7 @@ static void cmd_reg_enum(struct client_info *info)
}
/* open WINREG session. */
- res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG) : False;
+ res = res ? cli_nt_session_open(smb_cli, PI_WINREG) : False;
/* open registry receive a policy handle */
res = res ? do_reg_connect(smb_cli, full_keyname, key_name,
@@ -247,7 +247,7 @@ static void cmd_reg_query_key(struct client_info *info)
}
/* open WINREG session. */
- res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG) : False;
+ res = res ? cli_nt_session_open(smb_cli, PI_WINREG) : False;
/* open registry receive a policy handle */
res = res ? do_reg_connect(smb_cli, full_keyname, key_name,
@@ -410,7 +410,7 @@ static void cmd_reg_create_val(struct client_info *info)
dump_data(10, (char *)value.buffer, value.buf_len);
/* open WINREG session. */
- res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG) : False;
+ res = res ? cli_nt_session_open(smb_cli, PI_WINREG) : False;
/* open registry receive a policy handle */
res = res ? do_reg_connect(smb_cli, keyname, parent_name,
@@ -489,7 +489,7 @@ static void cmd_reg_delete_val(struct client_info *info)
}
/* open WINREG session. */
- res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG) : False;
+ res = res ? cli_nt_session_open(smb_cli, PI_WINREG) : False;
/* open registry receive a policy handle */
res = res ? do_reg_connect(smb_cli, keyname, parent_name,
@@ -564,7 +564,7 @@ static void cmd_reg_delete_key(struct client_info *info)
}
/* open WINREG session. */
- res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG) : False;
+ res = res ? cli_nt_session_open(smb_cli, PI_WINREG) : False;
/* open registry receive a policy handle */
res = res ? do_reg_connect(smb_cli, parent_name, key_name,
@@ -653,7 +653,7 @@ static void cmd_reg_create_key(struct client_info *info)
sam_access.mask = SEC_RIGHTS_READ;
/* open WINREG session. */
- res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG) : False;
+ res = res ? cli_nt_session_open(smb_cli, PI_WINREG) : False;
/* open registry receive a policy handle */
res = res ? do_reg_connect(smb_cli, parent_key, parent_name,
@@ -732,7 +732,7 @@ static void cmd_reg_test_key_sec(struct client_info *info)
}
/* open WINREG session. */
- res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG) : False;
+ res = res ? cli_nt_session_open(smb_cli, PI_WINREG) : False;
/* open registry receive a policy handle */
res = res ? do_reg_connect(smb_cli, full_keyname, key_name,
@@ -827,7 +827,7 @@ static void cmd_reg_get_key_sec(struct client_info *info)
}
/* open WINREG session. */
- res = res ? cli_nt_session_open(smb_cli, PIPE_WINREG) : False;
+ res = res ? cli_nt_session_open(smb_cli, PI_WINREG) : False;
/* open registry receive a policy handle */
res = res ? do_reg_connect(smb_cli, full_keyname, key_name,
@@ -973,10 +973,10 @@ struct cmd_set reg_commands[] = {
{ "REG" },
- { "shutdown", cmd_reg_shutdown, PIPE_WINREG, "Remote Shutdown",
+ { "shutdown", cmd_reg_shutdown, PI_WINREG, "Remote Shutdown",
"[-m message] [-t timeout] [-r] [-f] (-r == reboot, -f == force)" },
- { "abortshutdown", cmd_reg_abort_shutdown, PIPE_WINREG, "Abort Shutdown",
+ { "abortshutdown", cmd_reg_abort_shutdown, PI_WINREG, "Abort Shutdown",
"" },
/*
{ "regenum", cmd_reg_enum, "Registry Enumeration",
diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c
index d9251f90bd..7cc6e24d70 100644
--- a/source3/rpcclient/cmd_samr.c
+++ b/source3/rpcclient/cmd_samr.c
@@ -1406,23 +1406,23 @@ struct cmd_set samr_commands[] = {
{ "SAMR" },
- { "queryuser", cmd_samr_query_user, PIPE_SAMR, "Query user info", "" },
- { "querygroup", cmd_samr_query_group, PIPE_SAMR, "Query group info", "" },
- { "queryusergroups", cmd_samr_query_usergroups, PIPE_SAMR, "Query user groups", "" },
- { "queryuseraliases", cmd_samr_query_useraliases, PIPE_SAMR, "Query user aliases", "" },
- { "querygroupmem", cmd_samr_query_groupmem, PIPE_SAMR, "Query group membership", "" },
- { "queryaliasmem", cmd_samr_query_aliasmem, PIPE_SAMR, "Query alias membership", "" },
- { "querydispinfo", cmd_samr_query_dispinfo, PIPE_SAMR, "Query display info", "" },
- { "querydominfo", cmd_samr_query_dominfo, PIPE_SAMR, "Query domain info", "" },
- { "enumdomgroups", cmd_samr_enum_dom_groups, PIPE_SAMR, "Enumerate domain groups", "" },
- { "enumalsgroups", cmd_samr_enum_als_groups, PIPE_SAMR, "Enumerate alias groups", "" },
-
- { "createdomuser", cmd_samr_create_dom_user, PIPE_SAMR, "Create domain user", "" },
- { "samlookupnames", cmd_samr_lookup_names, PIPE_SAMR, "Look up names", "" },
- { "samlookuprids", cmd_samr_lookup_rids, PIPE_SAMR, "Look up names", "" },
- { "deletedomuser", cmd_samr_delete_dom_user, PIPE_SAMR, "Delete domain user", "" },
- { "samquerysecobj", cmd_samr_query_sec_obj, PIPE_SAMR, "Query SAMR security object", "" },
- { "getdompwinfo", cmd_samr_get_dom_pwinfo, PIPE_SAMR, "Retrieve domain password info", "" },
+ { "queryuser", cmd_samr_query_user, PI_SAMR, "Query user info", "" },
+ { "querygroup", cmd_samr_query_group, PI_SAMR, "Query group info", "" },
+ { "queryusergroups", cmd_samr_query_usergroups, PI_SAMR, "Query user groups", "" },
+ { "queryuseraliases", cmd_samr_query_useraliases, PI_SAMR, "Query user aliases", "" },
+ { "querygroupmem", cmd_samr_query_groupmem, PI_SAMR, "Query group membership", "" },
+ { "queryaliasmem", cmd_samr_query_aliasmem, PI_SAMR, "Query alias membership", "" },
+ { "querydispinfo", cmd_samr_query_dispinfo, PI_SAMR, "Query display info", "" },
+ { "querydominfo", cmd_samr_query_dominfo, PI_SAMR, "Query domain info", "" },
+ { "enumdomgroups", cmd_samr_enum_dom_groups, PI_SAMR, "Enumerate domain groups", "" },
+ { "enumalsgroups", cmd_samr_enum_als_groups, PI_SAMR, "Enumerate alias groups", "" },
+
+ { "createdomuser", cmd_samr_create_dom_user, PI_SAMR, "Create domain user", "" },
+ { "samlookupnames", cmd_samr_lookup_names, PI_SAMR, "Look up names", "" },
+ { "samlookuprids", cmd_samr_lookup_rids, PI_SAMR, "Look up names", "" },
+ { "deletedomuser", cmd_samr_delete_dom_user, PI_SAMR, "Delete domain user", "" },
+ { "samquerysecobj", cmd_samr_query_sec_obj, PI_SAMR, "Query SAMR security object", "" },
+ { "getdompwinfo", cmd_samr_get_dom_pwinfo, PI_SAMR, "Retrieve domain password info", "" },
{ NULL }
};
diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c
index 15648e4d1b..8d18aed168 100644
--- a/source3/rpcclient/cmd_spoolss.c
+++ b/source3/rpcclient/cmd_spoolss.c
@@ -1893,30 +1893,30 @@ struct cmd_set spoolss_commands[] = {
{ "SPOOLSS" },
- { "adddriver", cmd_spoolss_addprinterdriver, PIPE_SPOOLSS, "Add a print driver", "" },
- { "addprinter", cmd_spoolss_addprinterex, PIPE_SPOOLSS, "Add a printer", "" },
- { "deldriver", cmd_spoolss_deletedriver, PIPE_SPOOLSS, "Delete a printer driver", "" },
- { "enumdata", cmd_spoolss_not_implemented, PIPE_SPOOLSS, "Enumerate printer data (*)", "" },
- { "enumjobs", cmd_spoolss_enum_jobs, PIPE_SPOOLSS, "Enumerate print jobs", "" },
- { "enumports", cmd_spoolss_enum_ports, PIPE_SPOOLSS, "Enumerate printer ports", "" },
- { "enumdrivers", cmd_spoolss_enum_drivers, PIPE_SPOOLSS, "Enumerate installed printer drivers", "" },
- { "enumprinters", cmd_spoolss_enum_printers, PIPE_SPOOLSS, "Enumerate printers", "" },
- { "getdata", cmd_spoolss_not_implemented, PIPE_SPOOLSS, "Get print driver data (*)", "" },
- { "getdriver", cmd_spoolss_getdriver, PIPE_SPOOLSS, "Get print driver information", "" },
- { "getdriverdir", cmd_spoolss_getdriverdir, PIPE_SPOOLSS, "Get print driver upload directory", "" },
- { "getprinter", cmd_spoolss_getprinter, PIPE_SPOOLSS, "Get printer info", "" },
- { "getprintprocdir", cmd_spoolss_getprintprocdir, PIPE_SPOOLSS, "Get print processor directory", "" },
- { "openprinter", cmd_spoolss_open_printer_ex, PIPE_SPOOLSS, "Open printer handle", "" },
- { "setdriver", cmd_spoolss_setdriver, PIPE_SPOOLSS, "Set printer driver", "" },
- { "getprintprocdir", cmd_spoolss_getprintprocdir, PIPE_SPOOLSS, "Get print processor directory", "" },
- { "addform", cmd_spoolss_addform, PIPE_SPOOLSS, "Add form", "" },
- { "setform", cmd_spoolss_setform, PIPE_SPOOLSS, "Set form", "" },
- { "getform", cmd_spoolss_getform, PIPE_SPOOLSS, "Get form", "" },
- { "deleteform", cmd_spoolss_deleteform, PIPE_SPOOLSS, "Delete form", "" },
- { "enumforms", cmd_spoolss_enum_forms, PIPE_SPOOLSS, "Enumerate forms", "" },
- { "setprinter", cmd_spoolss_setprinter, PIPE_SPOOLSS, "Set printer comment", "" },
- { "setprinterdata", cmd_spoolss_setprinterdata, PIPE_SPOOLSS, "Set REG_SZ printer data", "" },
- { "rffpcnex", cmd_spoolss_rffpcnex, PIPE_SPOOLSS, "Rffpcnex test", "" },
+ { "adddriver", cmd_spoolss_addprinterdriver, PI_SPOOLSS, "Add a print driver", "" },
+ { "addprinter", cmd_spoolss_addprinterex, PI_SPOOLSS, "Add a printer", "" },
+ { "deldriver", cmd_spoolss_deletedriver, PI_SPOOLSS, "Delete a printer driver", "" },
+ { "enumdata", cmd_spoolss_not_implemented, PI_SPOOLSS, "Enumerate printer data (*)", "" },
+ { "enumjobs", cmd_spoolss_enum_jobs, PI_SPOOLSS, "Enumerate print jobs", "" },
+ { "enumports", cmd_spoolss_enum_ports, PI_SPOOLSS, "Enumerate printer ports", "" },
+ { "enumdrivers", cmd_spoolss_enum_drivers, PI_SPOOLSS, "Enumerate installed printer drivers", "" },
+ { "enumprinters", cmd_spoolss_enum_printers, PI_SPOOLSS, "Enumerate printers", "" },
+ { "getdata", cmd_spoolss_not_implemented, PI_SPOOLSS, "Get print driver data (*)", "" },
+ { "getdriver", cmd_spoolss_getdriver, PI_SPOOLSS, "Get print driver information", "" },
+ { "getdriverdir", cmd_spoolss_getdriverdir, PI_SPOOLSS, "Get print driver upload directory", "" },
+ { "getprinter", cmd_spoolss_getprinter, PI_SPOOLSS, "Get printer info", "" },
+ { "getprintprocdir", cmd_spoolss_getprintprocdir, PI_SPOOLSS, "Get print processor directory", "" },
+ { "openprinter", cmd_spoolss_open_printer_ex, PI_SPOOLSS, "Open printer handle", "" },
+ { "setdriver", cmd_spoolss_setdriver, PI_SPOOLSS, "Set printer driver", "" },
+ { "getprintprocdir", cmd_spoolss_getprintprocdir, PI_SPOOLSS, "Get print processor directory", "" },
+ { "addform", cmd_spoolss_addform, PI_SPOOLSS, "Add form", "" },
+ { "setform", cmd_spoolss_setform, PI_SPOOLSS, "Set form", "" },
+ { "getform", cmd_spoolss_getform, PI_SPOOLSS, "Get form", "" },
+ { "deleteform", cmd_spoolss_deleteform, PI_SPOOLSS, "Delete form", "" },
+ { "enumforms", cmd_spoolss_enum_forms, PI_SPOOLSS, "Enumerate forms", "" },
+ { "setprinter", cmd_spoolss_setprinter, PI_SPOOLSS, "Set printer comment", "" },
+ { "setprinterdata", cmd_spoolss_setprinterdata, PI_SPOOLSS, "Set REG_SZ printer data", "" },
+ { "rffpcnex", cmd_spoolss_rffpcnex, PI_SPOOLSS, "Rffpcnex test", "" },
{ NULL }
};
diff --git a/source3/rpcclient/cmd_srvsvc.c b/source3/rpcclient/cmd_srvsvc.c
index 8d416f8db0..282cbb3b99 100644
--- a/source3/rpcclient/cmd_srvsvc.c
+++ b/source3/rpcclient/cmd_srvsvc.c
@@ -353,10 +353,10 @@ struct cmd_set srvsvc_commands[] = {
{ "SRVSVC" },
- { "srvinfo", cmd_srvsvc_srv_query_info, PIPE_SRVSVC, "Server query info", "" },
- { "netshareenum", cmd_srvsvc_net_share_enum, PIPE_SRVSVC, "Enumerate shares", "" },
- { "netfileenum", cmd_srvsvc_net_file_enum, PIPE_SRVSVC, "Enumerate open files", "" },
- { "netremotetod", cmd_srvsvc_net_remote_tod, PIPE_SRVSVC, "Fetch remote time of day", "" },
+ { "srvinfo", cmd_srvsvc_srv_query_info, PI_SRVSVC, "Server query info", "" },
+ { "netshareenum", cmd_srvsvc_net_share_enum, PI_SRVSVC, "Enumerate shares", "" },
+ { "netfileenum", cmd_srvsvc_net_file_enum, PI_SRVSVC, "Enumerate open files", "" },
+ { "netremotetod", cmd_srvsvc_net_remote_tod, PI_SRVSVC, "Fetch remote time of day", "" },
{ NULL }
};
diff --git a/source3/rpcclient/cmd_wkssvc.c b/source3/rpcclient/cmd_wkssvc.c
index 79acf35943..bb118234c0 100644
--- a/source3/rpcclient/cmd_wkssvc.c
+++ b/source3/rpcclient/cmd_wkssvc.c
@@ -57,7 +57,7 @@ void cmd_wks_query_info(struct client_info *info)
DEBUG(5, ("cmd_wks_query_info: smb_cli->fd:%d\n", smb_cli->fd));
/* open LSARPC session. */
- res = res ? cli_nt_session_open(smb_cli, PIPE_WKSSVC) : False;
+ res = res ? cli_nt_session_open(smb_cli, PI_WKSSVC) : False;
/* send info level: receive requested info. hopefully. */
res = res ? do_wks_query_info(smb_cli,
diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c
index 880fdc599a..9c6cd3794b 100644
--- a/source3/rpcclient/rpcclient.c
+++ b/source3/rpcclient/rpcclient.c
@@ -204,7 +204,7 @@ static void fetch_machine_sid(struct cli_state *cli)
}
- if (!cli_nt_session_open (cli, PIPE_LSARPC)) {
+ if (!cli_nt_session_open (cli, PI_LSARPC)) {
fprintf(stderr, "could not initialise lsa pipe\n");
goto error;
}
@@ -377,18 +377,18 @@ static struct cmd_set rpcclient_commands[] = {
{ "GENERAL OPTIONS" },
- { "help", cmd_help, NULL, "Get help on commands", "[command]" },
- { "?", cmd_help, NULL, "Get help on commands", "[command]" },
- { "debuglevel", cmd_debuglevel, NULL, "Set debug level", "level" },
- { "list", cmd_listcommands, NULL, "List available commands on <pipe>", "pipe" },
- { "exit", cmd_quit, NULL, "Exit program", "" },
- { "quit", cmd_quit, NULL, "Exit program", "" },
+ { "help", cmd_help, -1, "Get help on commands", "[command]" },
+ { "?", cmd_help, -1, "Get help on commands", "[command]" },
+ { "debuglevel", cmd_debuglevel, -1, "Set debug level", "level" },
+ { "list", cmd_listcommands, -1, "List available commands on <pipe>", "pipe" },
+ { "exit", cmd_quit, -1, "Exit program", "" },
+ { "quit", cmd_quit, -1, "Exit program", "" },
{ NULL }
};
static struct cmd_set separator_command[] = {
- { "---------------", NULL, NULL, "----------------------" },
+ { "---------------", NULL, -1, "----------------------" },
{ NULL }
};
@@ -483,10 +483,9 @@ static NTSTATUS do_cmd(struct cli_state *cli, struct cmd_set *cmd_entry,
/* Open pipe */
- if (cmd_entry->pipe)
- if (!cli_nt_session_open(cli, cmd_entry->pipe)) {
- DEBUG(0, ("Could not initialise %s\n",
- cmd_entry->pipe));
+ if (cmd_entry->pipe_idx != -1)
+ if (!cli_nt_session_open(cli, cmd_entry->pipe_idx)) {
+ DEBUG(0, ("Could not initialise pipe\n"));
goto done;
}
@@ -496,7 +495,7 @@ static NTSTATUS do_cmd(struct cli_state *cli, struct cmd_set *cmd_entry,
/* Cleanup */
- if (cmd_entry->pipe)
+ if (cmd_entry->pipe_idx != -1)
cli_nt_session_close(cli);
talloc_destroy(mem_ctx);
diff --git a/source3/rpcclient/rpcclient.h b/source3/rpcclient/rpcclient.h
index 72491373d6..ae5b5f3c4f 100644
--- a/source3/rpcclient/rpcclient.h
+++ b/source3/rpcclient/rpcclient.h
@@ -26,7 +26,7 @@ struct cmd_set {
char *name;
NTSTATUS (*fn)(struct cli_state*, TALLOC_CTX *mem_ctx, int argc,
char **argv);
- char *pipe;
+ int pipe_idx;
char *description;
char *usage;
};
diff --git a/source3/rpcclient/samsync.c b/source3/rpcclient/samsync.c
index 7124f9416a..fb07123b77 100644
--- a/source3/rpcclient/samsync.c
+++ b/source3/rpcclient/samsync.c
@@ -378,7 +378,7 @@ static NTSTATUS sam_sync(struct cli_state *cli, unsigned char trust_passwd[16],
return result;
}
- if (!cli_nt_session_open (cli, PIPE_NETLOGON)) {
+ if (!cli_nt_session_open (cli, PI_NETLOGON)) {
DEBUG(0, ("Could not initialize netlogon pipe!\n"));
goto done;
}
diff --git a/source3/smbd/change_trust_pw.c b/source3/smbd/change_trust_pw.c
index 0c468699b4..4b2944a96f 100644
--- a/source3/smbd/change_trust_pw.c
+++ b/source3/smbd/change_trust_pw.c
@@ -60,7 +60,7 @@ static NTSTATUS modify_trust_password( char *domain, char *remote_machine,
* Now start the NT Domain stuff :-).
*/
- if(cli_nt_session_open(cli, PIPE_NETLOGON) == False) {
+ if(cli_nt_session_open(cli, PI_NETLOGON) == False) {
DEBUG(0,("modify_trust_password: unable to open the domain client session to \
machine %s. Error was : %s.\n", remote_machine, cli_errstr(cli)));
cli_nt_session_close(cli);
diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c
index 11f73a1387..06538797e2 100644
--- a/source3/utils/net_rpc.c
+++ b/source3/utils/net_rpc.c
@@ -71,7 +71,7 @@ static DOM_SID *net_get_remote_domain_sid(struct cli_state *cli)
}
- if (!cli_nt_session_open (cli, PIPE_LSARPC)) {
+ if (!cli_nt_session_open (cli, PI_LSARPC)) {
fprintf(stderr, "could not initialise lsa pipe\n");
goto error;
}
@@ -117,7 +117,7 @@ static DOM_SID *net_get_remote_domain_sid(struct cli_state *cli)
* @return A shell status integer (0 for success)
*/
-static int run_rpc_command(struct cli_state *cli_arg, const char *pipe_name, int conn_flags,
+static int run_rpc_command(struct cli_state *cli_arg, const int pipe_idx, int conn_flags,
rpc_command_fn fn,
int argc, const char **argv)
{
@@ -146,8 +146,8 @@ static int run_rpc_command(struct cli_state *cli_arg, const char *pipe_name, int
return -1;
}
- if (!cli_nt_session_open(cli, pipe_name)) {
- DEBUG(0, ("Could not initialise %s pipe\n", pipe_name));
+ if (!cli_nt_session_open(cli, pipe_idx)) {
+ DEBUG(0, ("Could not initialise pipe\n"));
}
nt_status = fn(domain_sid, cli, mem_ctx, argc, argv);
@@ -209,7 +209,7 @@ static NTSTATUS rpc_changetrustpw_internals(const DOM_SID *domain_sid, struct cl
static int rpc_changetrustpw(int argc, const char **argv)
{
- return run_rpc_command(NULL, PIPE_NETLOGON, NET_FLAGS_ANONYMOUS | NET_FLAGS_PDC, rpc_changetrustpw_internals,
+ return run_rpc_command(NULL, PI_NETLOGON, NET_FLAGS_ANONYMOUS | NET_FLAGS_PDC, rpc_changetrustpw_internals,
argc, argv);
}
@@ -277,7 +277,7 @@ static NTSTATUS rpc_join_oldstyle_internals(const DOM_SID *domain_sid, struct cl
static int net_rpc_join_oldstyle(int argc, const char **argv)
{
- return run_rpc_command(NULL, PIPE_NETLOGON, NET_FLAGS_ANONYMOUS | NET_FLAGS_PDC, rpc_join_oldstyle_internals,
+ return run_rpc_command(NULL, PI_NETLOGON, NET_FLAGS_ANONYMOUS | NET_FLAGS_PDC, rpc_join_oldstyle_internals,
argc, argv);
}
@@ -400,7 +400,7 @@ rpc_info_internals(const DOM_SID *domain_sid, struct cli_state *cli,
**/
int net_rpc_info(int argc, const char **argv)
{
- return run_rpc_command(NULL, PIPE_SAMR, NET_FLAGS_ANONYMOUS | NET_FLAGS_PDC,
+ return run_rpc_command(NULL, PI_SAMR, NET_FLAGS_ANONYMOUS | NET_FLAGS_PDC,
rpc_info_internals,
argc, argv);
}
@@ -449,7 +449,7 @@ rpc_getsid_internals(const DOM_SID *domain_sid, struct cli_state *cli,
**/
int net_rpc_getsid(int argc, const char **argv)
{
- return run_rpc_command(NULL, PIPE_SAMR, NET_FLAGS_ANONYMOUS | NET_FLAGS_PDC,
+ return run_rpc_command(NULL, PI_SAMR, NET_FLAGS_ANONYMOUS | NET_FLAGS_PDC,
rpc_getsid_internals,
argc, argv);
}
@@ -553,7 +553,7 @@ static NTSTATUS rpc_user_add_internals(const DOM_SID *domain_sid, struct cli_sta
static int rpc_user_add(int argc, const char **argv)
{
- return run_rpc_command(NULL, PIPE_SAMR, 0, rpc_user_add_internals,
+ return run_rpc_command(NULL, PI_SAMR, 0, rpc_user_add_internals,
argc, argv);
}
@@ -654,7 +654,7 @@ static NTSTATUS rpc_user_del_internals(const DOM_SID *domain_sid,
static int rpc_user_delete(int argc, const char **argv)
{
- return run_rpc_command(NULL, PIPE_SAMR, 0, rpc_user_del_internals,
+ return run_rpc_command(NULL, PI_SAMR, 0, rpc_user_del_internals,
argc, argv);
}
@@ -756,7 +756,7 @@ rpc_user_info_internals(const DOM_SID *domain_sid, struct cli_state *cli,
static int rpc_user_info(int argc, const char **argv)
{
- return run_rpc_command(NULL, PIPE_SAMR, 0, rpc_user_info_internals,
+ return run_rpc_command(NULL, PI_SAMR, 0, rpc_user_info_internals,
argc, argv);
}
@@ -851,7 +851,7 @@ int net_rpc_user(int argc, const char **argv)
if (opt_long_list_entries) {
} else {
}
- return run_rpc_command(NULL,PIPE_SAMR, 0,
+ return run_rpc_command(NULL,PI_SAMR, 0,
rpc_user_list_internals,
argc, argv);
}
@@ -1002,7 +1002,7 @@ int net_rpc_group(int argc, const char **argv)
if (opt_long_list_entries) {
} else {
}
- return run_rpc_command(NULL, PIPE_SAMR, 0,
+ return run_rpc_command(NULL, PI_SAMR, 0,
rpc_group_list_internals,
argc, argv);
}
@@ -1060,7 +1060,7 @@ static int rpc_share_add(int argc, const char **argv)
DEBUG(1,("Sharename or path not specified on add\n"));
return rpc_share_usage(argc, argv);
}
- return run_rpc_command(NULL, PIPE_SRVSVC, 0,
+ return run_rpc_command(NULL, PI_SRVSVC, 0,
rpc_share_add_internals,
argc, argv);
}
@@ -1106,7 +1106,7 @@ static int rpc_share_delete(int argc, const char **argv)
DEBUG(1,("Sharename not specified on delete\n"));
return rpc_share_usage(argc, argv);
}
- return run_rpc_command(NULL, PIPE_SRVSVC, 0,
+ return run_rpc_command(NULL, PI_SRVSVC, 0,
rpc_share_del_internals,
argc, argv);
}
@@ -1196,7 +1196,7 @@ int net_rpc_share(int argc, const char **argv)
};
if (argc == 0)
- return run_rpc_command(NULL, PIPE_SRVSVC, 0,
+ return run_rpc_command(NULL, PI_SRVSVC, 0,
rpc_share_list_internals,
argc, argv);
@@ -1250,7 +1250,7 @@ static int rpc_file_close(int argc, const char **argv)
return(rpc_file_usage(argc, argv));
}
- return run_rpc_command(NULL, PIPE_SRVSVC, 0,
+ return run_rpc_command(NULL, PI_SRVSVC, 0,
rpc_file_close_internals,
argc, argv);
}
@@ -1341,7 +1341,7 @@ static int rpc_file_user(int argc, const char **argv)
return(rpc_file_usage(argc, argv));
}
- return run_rpc_command(NULL, PIPE_SRVSVC, 0,
+ return run_rpc_command(NULL, PI_SRVSVC, 0,
rpc_file_list_internals,
argc, argv);
}
@@ -1366,7 +1366,7 @@ int net_rpc_file(int argc, const char **argv)
};
if (argc == 0)
- return run_rpc_command(NULL, PIPE_SRVSVC, 0,
+ return run_rpc_command(NULL, PI_SRVSVC, 0,
rpc_file_list_internals,
argc, argv);
@@ -1421,7 +1421,7 @@ static NTSTATUS rpc_shutdown_abort_internals(const DOM_SID *domain_sid, struct c
static int rpc_shutdown_abort(int argc, const char **argv)
{
- return run_rpc_command(NULL, PIPE_WINREG, 0, rpc_shutdown_abort_internals,
+ return run_rpc_command(NULL, PI_WINREG, 0, rpc_shutdown_abort_internals,
argc, argv);
}
@@ -1511,7 +1511,7 @@ static NTSTATUS rpc_shutdown_internals(const DOM_SID *domain_sid, struct cli_sta
static int rpc_shutdown(int argc, const char **argv)
{
- return run_rpc_command(NULL, PIPE_WINREG, 0, rpc_shutdown_internals,
+ return run_rpc_command(NULL, PI_WINREG, 0, rpc_shutdown_internals,
argc, argv);
}
@@ -1602,7 +1602,7 @@ static NTSTATUS rpc_trustdom_add_internals(const DOM_SID *domain_sid, struct cli
static int rpc_trustdom_add(int argc, const char **argv)
{
- return run_rpc_command(NULL, PIPE_SAMR, 0, rpc_trustdom_add_internals,
+ return run_rpc_command(NULL, PI_SAMR, 0, rpc_trustdom_add_internals,
argc, argv);
}
@@ -1718,7 +1718,7 @@ static int rpc_trustdom_establish(int argc, const char **argv)
* note: It is now used only to get unicode domain name
*/
- if (!cli_nt_session_open(cli, PIPE_WKSSVC)) {
+ if (!cli_nt_session_open(cli, PI_WKSSVC)) {
DEBUG(0, ("Couldn't not initialise wkssvc pipe\n"));
return -1;
}
@@ -1751,7 +1751,7 @@ static int rpc_trustdom_establish(int argc, const char **argv)
return -1;
}
- if (!cli_nt_session_open(cli, PIPE_LSARPC)) {
+ if (!cli_nt_session_open(cli, PI_LSARPC)) {
DEBUG(0, ("Could not initialise lsa pipe\n"));
cli_shutdown(cli);
return -1;
@@ -1929,7 +1929,7 @@ static int rpc_trustdom_list(int argc, const char **argv)
return -1;
};
- if (!cli_nt_session_open(cli, PIPE_LSARPC)) {
+ if (!cli_nt_session_open(cli, PI_LSARPC)) {
DEBUG(0, ("Could not initialise lsa pipe\n"));
return -1;
};
@@ -2008,7 +2008,7 @@ static int rpc_trustdom_list(int argc, const char **argv)
/*
* Open \PIPE\samr and get needed policy handles
*/
- if (!cli_nt_session_open(cli, PIPE_SAMR)) {
+ if (!cli_nt_session_open(cli, PI_SAMR)) {
DEBUG(0, ("Could not initialise samr pipe\n"));
return -1;
};
@@ -2080,7 +2080,7 @@ static int rpc_trustdom_list(int argc, const char **argv)
remote_cli = net_make_ipc_connection(NET_FLAGS_PDC | NET_FLAGS_ANONYMOUS);
if (remote_cli) {
/* query for domain's sid */
- if (run_rpc_command(remote_cli, PIPE_LSARPC, 0, rpc_query_domain_sid, argc, argv))
+ if (run_rpc_command(remote_cli, PI_LSARPC, 0, rpc_query_domain_sid, argc, argv))
d_printf("couldn't get domain's sid\n");
cli_shutdown(remote_cli);
diff --git a/source3/utils/net_rpc_join.c b/source3/utils/net_rpc_join.c
index b08095f1cc..c209886ef1 100644
--- a/source3/utils/net_rpc_join.c
+++ b/source3/utils/net_rpc_join.c
@@ -56,7 +56,7 @@ int net_rpc_join_ok(const char *domain)
return 1;
}
- if (!cli_nt_session_open(cli, PIPE_NETLOGON)) {
+ if (!cli_nt_session_open(cli, PI_NETLOGON)) {
DEBUG(0,("Error connecting to NETLOGON pipe\n"));
goto done;
}
@@ -150,7 +150,7 @@ int net_rpc_join_newstyle(int argc, const char **argv)
/* Fetch domain sid */
- if (!cli_nt_session_open(cli, PIPE_LSARPC)) {
+ if (!cli_nt_session_open(cli, PI_LSARPC)) {
DEBUG(0, ("Error connecting to SAM pipe\n"));
goto done;
}
@@ -170,7 +170,7 @@ int net_rpc_join_newstyle(int argc, const char **argv)
cli_nt_session_close(cli); /* Done with this pipe */
/* Create domain user */
- if (!cli_nt_session_open(cli, PIPE_SAMR)) {
+ if (!cli_nt_session_open(cli, PI_SAMR)) {
DEBUG(0, ("Error connecting to SAM pipe\n"));
goto done;
}
diff --git a/source3/utils/net_rpc_samsync.c b/source3/utils/net_rpc_samsync.c
index c040b3cca2..00e5dee0ce 100644
--- a/source3/utils/net_rpc_samsync.c
+++ b/source3/utils/net_rpc_samsync.c
@@ -156,7 +156,7 @@ int rpc_samdump(int argc, const char **argv)
return 1;
}
- if (!cli_nt_session_open(cli, PIPE_NETLOGON)) {
+ if (!cli_nt_session_open(cli, PI_NETLOGON)) {
DEBUG(0,("Error connecting to NETLOGON pipe\n"));
goto fail;
}
@@ -669,7 +669,7 @@ int rpc_vampire(int argc, const char **argv)
return 1;
}
- if (!cli_nt_session_open(cli, PIPE_NETLOGON)) {
+ if (!cli_nt_session_open(cli, PI_NETLOGON)) {
DEBUG(0,("Error connecting to NETLOGON pipe\n"));
goto fail;
}
diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c
index 4f9df90fa2..2e8317f05a 100644
--- a/source3/utils/smbcacls.c
+++ b/source3/utils/smbcacls.c
@@ -83,7 +83,7 @@ static BOOL cacls_open_policy_hnd(void)
if (!global_hack_cli) {
global_hack_cli = connect_one("IPC$");
- if (!cli_nt_session_open (global_hack_cli, PIPE_LSARPC)) {
+ if (!cli_nt_session_open (global_hack_cli, PI_LSARPC)) {
return False;
}
}