summaryrefslogtreecommitdiff
path: root/source3/include
diff options
context:
space:
mode:
Diffstat (limited to 'source3/include')
-rw-r--r--source3/include/client.h15
-rw-r--r--source3/include/ntdomain.h4
-rw-r--r--source3/include/proto.h118
-rw-r--r--source3/include/rpc_creds.h92
-rw-r--r--source3/include/smb.h61
5 files changed, 268 insertions, 22 deletions
diff --git a/source3/include/client.h b/source3/include/client.h
index 15ba66e3e1..2a780ece26 100644
--- a/source3/include/client.h
+++ b/source3/include/client.h
@@ -56,21 +56,6 @@ struct print_job_info
time_t t;
};
-struct pwd_info
-{
- BOOL null_pwd;
- BOOL cleartext;
- BOOL crypted;
-
- fstring password;
-
- uchar smb_lm_pwd[16];
- uchar smb_nt_pwd[16];
-
- uchar smb_lm_owf[24];
- uchar smb_nt_owf[24];
-};
-
struct cli_state {
int port;
int fd;
diff --git a/source3/include/ntdomain.h b/source3/include/ntdomain.h
index d066ef3e36..07d06656c0 100644
--- a/source3/include/ntdomain.h
+++ b/source3/include/ntdomain.h
@@ -131,6 +131,10 @@ typedef struct pipes_struct
/* When replying to an SMBtrans, this is the maximum amount of
data that can be sent in the initial reply. */
int max_trans_reply;
+
+ /* remote, server-side rpc redirection */
+ struct msrpc_state *m;
+
} pipes_struct;
struct api_struct
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 92a57c0950..bb1d5477df 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -70,6 +70,7 @@ int dos_mkdir(char *dname,mode_t mode);
int dos_rmdir(char *dname);
int dos_chdir(char *dname);
int dos_utime(char *fname,struct utimbuf *times);
+int copy_reg(char *source, const char *dest);
int dos_rename(char *from, char *to);
int dos_chmod(char *fname,mode_t mode);
char *dos_getwd(char *unix_path);
@@ -125,6 +126,36 @@ void initialize_multibyte_vectors( int client_codepage);
void mdfour(unsigned char *out, unsigned char *in, int n);
+/*The following definitions come from lib/msrpc-client.c */
+
+BOOL receive_msrpc(int fd, prs_struct *data, unsigned int timeout);
+BOOL msrpc_send(int fd, prs_struct *ps);
+BOOL msrpc_receive(int fd, prs_struct *ps);
+BOOL msrpc_connect(struct msrpc_state *msrpc, const char *pipe_name);
+void msrpc_init_creds(struct msrpc_state *msrpc, const struct user_creds *usr);
+void msrpc_close_socket(struct msrpc_state *msrpc);
+void msrpc_sockopt(struct msrpc_state *msrpc, char *options);
+BOOL msrpc_connect_auth(struct msrpc_state *msrpc,
+ const char* pipename,
+ const struct user_creds *usr);
+struct msrpc_state *msrpc_initialise(struct msrpc_state *msrpc);
+void msrpc_shutdown(struct msrpc_state *msrpc);
+BOOL msrpc_establish_connection(struct msrpc_state *msrpc,
+ const char *pipe_name);
+
+/*The following definitions come from lib/msrpc_use.c */
+
+void init_msrpc_use(void);
+void free_msrpc_use(void);
+struct msrpc_state *msrpc_use_add(const char* pipe_name,
+ const struct user_creds *usr_creds,
+ BOOL redir);
+BOOL msrpc_use_del(const char* pipe_name,
+ const struct user_creds *usr_creds,
+ BOOL force_close,
+ BOOL *connection_closed);
+void msrpc_net_use_enum(uint32 *num_cons, struct use_info ***use);
+
/*The following definitions come from lib/pidfile.c */
pid_t pidfile_pid(char *name);
@@ -234,6 +265,7 @@ void putip(void *dest,void *src);
char *dns_to_netbios_name(char *dns_name);
int name_mangle( char *In, char *Out, char name_type );
BOOL file_exist(char *fname,SMB_STRUCT_STAT *sbuf);
+int file_rename(char *from, char *to);
time_t file_modtime(char *fname);
BOOL directory_exist(char *dname,SMB_STRUCT_STAT *st);
SMB_OFF_T get_file_size(char *file_name);
@@ -310,6 +342,23 @@ void *memdup(void *p, size_t size);
char *myhostname(void);
char *lock_path(char *name);
+/*The following definitions come from lib/util_array.c */
+
+void free_void_array(uint32 num_entries, void **entries,
+ void(free_item)(void*));
+void* add_copy_to_array(uint32 *len, void ***array, const void *item,
+ void*(item_dup)(const void*), BOOL alloc_anyway);
+void* add_item_to_array(uint32 *len, void ***array, void *item);
+void free_use_info_array(uint32 num_entries, struct use_info **entries);
+struct use_info* add_use_info_to_array(uint32 *len, struct use_info ***array,
+ const struct use_info *name);
+void free_char_array(uint32 num_entries, char **entries);
+char* add_chars_to_array(uint32 *len, char ***array, const char *name);
+void free_uint32_array(uint32 num_entries, uint32 **entries);
+uint32* add_uint32s_to_array(uint32 *len, uint32 ***array, const uint32 *name);
+void free_sid_array(uint32 num_entries, DOM_SID **entries);
+DOM_SID* add_sid_to_array(uint32 *len, DOM_SID ***array, const DOM_SID *sid);
+
/*The following definitions come from lib/util_file.c */
BOOL do_file_lock(int fd, int waitsecs, int type);
@@ -345,11 +394,14 @@ char *sid_to_string(fstring sidstr_out, DOM_SID *sid);
BOOL string_to_sid(DOM_SID *sidout, char *sidstr);
BOOL sid_append_rid(DOM_SID *sid, uint32 rid);
BOOL sid_split_rid(DOM_SID *sid, uint32 *rid);
-void sid_copy(DOM_SID *dst, DOM_SID *src);
+void sid_copy(DOM_SID *dst, const DOM_SID *src);
DOM_SID *sid_dup(DOM_SID *src);
BOOL sid_linearize(char *outbuf, size_t len, DOM_SID *sid);
BOOL sid_equal(DOM_SID *sid1, DOM_SID *sid2);
size_t sid_size(DOM_SID *sid);
+BOOL read_sid(char *sam_name, DOM_SID *sid);
+BOOL write_sid(char *sam_name, DOM_SID *sid);
+BOOL create_new_sid(DOM_SID *sid);
/*The following definitions come from lib/util_sock.c */
@@ -374,6 +426,9 @@ int open_socket_out(int type, struct in_addr *addr, int port ,int timeout);
void reset_globals_after_fork(void);
char *client_name(int fd);
char *client_addr(int fd);
+int open_pipe_sock(char *path);
+int create_pipe_socket(char *dir, int dir_perms,
+ char *path, int path_perms);
/*The following definitions come from lib/util_str.c */
@@ -645,6 +700,7 @@ BOOL remote_password_change(const char *remote_machine, const char *user_name,
void pwd_init(struct pwd_info *pwd);
void pwd_obfuscate_key(struct pwd_info *pwd, uint32 int_key, char *str_key);
+BOOL pwd_compare(struct pwd_info *pwd1, struct pwd_info *pwd2);
void pwd_read(struct pwd_info *pwd, char *passwd_report, BOOL do_encrypt);
void pwd_set_nullpwd(struct pwd_info *pwd);
void pwd_set_cleartext(struct pwd_info *pwd, char *clr);
@@ -684,7 +740,8 @@ char *smb_errstr(char *inbuf);
void unexpected_packet(struct packet_struct *p);
void clear_unexpected(time_t t);
-struct packet_struct *receive_unexpected(enum packet_type packet_type, int id, char *mailslot_name);
+struct packet_struct *receive_unexpected(enum packet_type packet_type, int id,
+ char *mailslot_name);
/*The following definitions come from locking/locking.c */
@@ -1355,7 +1412,7 @@ void pdb_set_last_set_time(char *p, int max_len, time_t t);
void pdb_sethexpwd(char *p, unsigned char *pwd, uint16 acct_ctrl);
BOOL pdb_gethexpwd(char *p, unsigned char *pwd);
BOOL pdb_name_to_rid(char *user_name, uint32 *u_rid, uint32 *g_rid);
-BOOL pdb_generate_sam_sid(void);
+BOOL pdb_generate_sam_sid(char *domain_name, DOM_SID *sid);
uid_t pdb_user_rid_to_uid(uint32 user_rid);
gid_t pdb_user_rid_to_gid(uint32 user_rid);
uint32 pdb_uid_to_user_rid(uid_t uid);
@@ -1581,6 +1638,45 @@ BOOL do_wks_query_info(struct cli_state *cli,
char *server_name, uint32 switch_value,
WKS_INFO_100 *wks100);
+/*The following definitions come from rpc_parse/parse_creds.c */
+
+BOOL make_creds_unix(CREDS_UNIX *r_u, const char* user_name,
+ const char* requested_name,
+ const char* real_name,
+ BOOL guest);
+BOOL creds_io_unix(char *desc, CREDS_UNIX *r_u, prs_struct *ps, int depth);
+void creds_free_unix(CREDS_UNIX *r_u);
+BOOL make_creds_unix_sec(CREDS_UNIX_SEC *r_u,
+ uint32 uid, uint32 gid, uint32 num_grps, gid_t *grps);
+BOOL creds_io_unix_sec(char *desc, CREDS_UNIX_SEC *r_u, prs_struct *ps, int depth);
+void creds_free_unix_sec(CREDS_UNIX_SEC *r_u);
+BOOL make_creds_nt_sec(CREDS_NT_SEC *r_u,
+ DOM_SID *sid, uint32 num_grps, uint32 *grps);
+BOOL creds_io_nt_sec(char *desc, CREDS_NT_SEC *r_u, prs_struct *ps, int depth);
+void creds_free_nt_sec(CREDS_NT_SEC *r_u);
+BOOL creds_io_pwd_info(char *desc, struct pwd_info *pwd, prs_struct *ps, int depth);
+BOOL creds_io_nt(char *desc, CREDS_NT *r_u, prs_struct *ps, int depth);
+void creds_free_nt(CREDS_NT *r_u);
+BOOL creds_io_hybrid(char *desc, CREDS_HYBRID *r_u, prs_struct *ps, int depth);
+void copy_unix_creds(CREDS_UNIX *to, const CREDS_UNIX *from);
+void copy_nt_sec_creds(CREDS_NT_SEC *to, const CREDS_NT_SEC *from);
+void copy_unix_sec_creds(CREDS_UNIX_SEC *to, const CREDS_UNIX_SEC *from);
+void copy_nt_creds(struct ntuser_creds *to,
+ const struct ntuser_creds *from);
+void copy_user_creds(struct user_creds *to,
+ const struct user_creds *from);
+void free_user_creds(struct user_creds *creds);
+BOOL creds_io_cmd(char *desc, CREDS_CMD *r_u, prs_struct *ps, int depth);
+BOOL create_ntuser_creds( prs_struct *ps,
+ const char* name,
+ uint16 version, uint16 command,
+ const struct ntuser_creds *ntu,
+ BOOL reuse);
+BOOL create_user_creds( prs_struct *ps,
+ const char* name,
+ uint16 version, uint16 command,
+ const struct user_creds *usr);
+
/*The following definitions come from rpc_parse/parse_lsa.c */
void init_lsa_trans_name(LSA_TRANS_NAME *trn, UNISTR2 *uni_name,
@@ -1769,6 +1865,7 @@ BOOL net_io_r_sam_logoff(char *desc, NET_R_SAM_LOGOFF *r_l, prs_struct *ps, int
void prs_debug(prs_struct *ps, int depth, char *desc, char *fn_name);
BOOL prs_init(prs_struct *ps, uint32 size, uint8 align, BOOL io);
+BOOL prs_read(prs_struct *ps, int fd, size_t len, int timeout);
void prs_mem_free(prs_struct *ps);
void prs_give_memory(prs_struct *ps, char *buf, uint32 size, BOOL is_dynamic);
char *prs_take_memory(prs_struct *ps, uint32 *psize);
@@ -2245,10 +2342,10 @@ BOOL api_netlog_rpc(pipes_struct *p, prs_struct *data);
/*The following definitions come from rpc_server/srv_pipe.c */
-BOOL create_next_pdu(pipes_struct *p);
-BOOL rpc_command(pipes_struct *p, char *input_data, int data_len);
-BOOL api_rpcTNP(pipes_struct *p, char *rpc_name, struct api_struct *api_rpc_cmds,
- prs_struct *rpc_in);
+BOOL readwrite_pipe(pipes_struct *p, char *data, int len,
+ char **rdata, int *rlen);
+ssize_t write_pipe(pipes_struct *p, char *data, size_t n);
+int read_pipe(pipes_struct *p, char *data, int n);
/*The following definitions come from rpc_server/srv_pipe_hnd.c */
@@ -2266,6 +2363,13 @@ BOOL close_rpc_pipe_hnd(pipes_struct *p, connection_struct *conn);
pipes_struct *get_rpc_pipe_p(char *buf, int where);
pipes_struct *get_rpc_pipe(int pnum);
+/*The following definitions come from rpc_server/srv_pipe_srv.c */
+
+BOOL create_next_pdu(pipes_struct *p);
+BOOL rpc_command(pipes_struct *p, char *input_data, int data_len);
+BOOL api_rpcTNP(pipes_struct *p, char *rpc_name, struct api_struct *api_rpc_cmds,
+ prs_struct *rpc_in);
+
/*The following definitions come from rpc_server/srv_reg.c */
BOOL api_reg_rpc(pipes_struct *p, prs_struct *data);
diff --git a/source3/include/rpc_creds.h b/source3/include/rpc_creds.h
new file mode 100644
index 0000000000..c389c64d1d
--- /dev/null
+++ b/source3/include/rpc_creds.h
@@ -0,0 +1,92 @@
+/*
+ Unix SMB/Netbios implementation.
+ Version 1.9.
+ SMB parameters and setup
+ Copyright (C) Andrew Tridgell 1992-1999
+ Copyright (C) Luke Kenneth Casson Leighton 1996-1999
+
+ 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 2 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, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef _RPC_CREDS_H /* _RPC_CREDS_H */
+#define _RPC_CREDS_H
+
+typedef struct ntuser_creds
+{
+ fstring user_name;
+ fstring domain;
+ struct pwd_info pwd;
+
+ uint32 ntlmssp_flags;
+
+} CREDS_NT;
+
+typedef struct unixuser_creds
+{
+ fstring user_name;
+ fstring requested_name;
+ fstring real_name;
+ BOOL guest;
+
+} CREDS_UNIX;
+
+typedef struct unixsec_creds
+{
+ uint32 uid;
+ uint32 gid;
+ int num_grps;
+ uint32 *grps;
+
+} CREDS_UNIX_SEC;
+
+typedef struct ntsec_creds
+{
+ DOM_SID sid;
+ uint32 num_grps;
+ uint32 *grp_rids;
+
+} CREDS_NT_SEC;
+
+typedef struct user_creds
+{
+ BOOL reuse;
+ uint32 ptr_ntc;
+ uint32 ptr_uxc;
+ uint32 ptr_nts;
+ uint32 ptr_uxs;
+
+ CREDS_NT ntc;
+ CREDS_UNIX uxc;
+
+ CREDS_NT_SEC nts;
+ CREDS_UNIX_SEC uxs;
+
+
+} CREDS_HYBRID;
+
+typedef struct cred_command
+{
+ uint16 version;
+ uint16 command;
+
+ fstring name;
+
+ uint32 ptr_creds;
+ CREDS_HYBRID *cred;
+
+} CREDS_CMD;
+
+#endif /* _RPC_CREDS_H */
+
diff --git a/source3/include/smb.h b/source3/include/smb.h
index ec1aaf2273..7b4e80ed4b 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -438,6 +438,14 @@ struct sam_disp_info
char *full_name; /* user's full name string */
};
+struct use_info
+{
+ BOOL connected;
+ char *srv_name;
+ char *user_name;
+ char *domain;
+};
+
#define MAXSUBAUTHS 15 /* max sub authorities in a SID */
/* DOM_SID - security id */
@@ -1768,6 +1776,59 @@ struct nmb_name {
unsigned int name_type;
};
+#define AGENT_CMD_CON 0
+#define AGENT_CMD_CON_ANON 2
+#define AGENT_CMD_CON_REUSE 1
+
+struct pwd_info
+{
+ BOOL null_pwd;
+ BOOL cleartext;
+ BOOL crypted;
+
+ fstring password;
+
+ uchar smb_lm_pwd[16];
+ uchar smb_nt_pwd[16];
+
+ uchar smb_lm_owf[24];
+ uchar smb_nt_owf[128];
+ size_t nt_owf_len;
+
+ uchar lm_cli_chal[8];
+ uchar nt_cli_chal[128];
+ size_t nt_cli_chal_len;
+
+ uchar sess_key[16];
+};
+
+#include "rpc_creds.h"
+
+struct ntdom_info
+{
+ unsigned char sess_key[16]; /* Current session key. */
+ unsigned char ntlmssp_hash[258]; /* ntlmssp data. */
+ uint32 ntlmssp_cli_flgs; /* ntlmssp client flags */
+ uint32 ntlmssp_srv_flgs; /* ntlmssp server flags */
+ uint32 ntlmssp_seq_num; /* ntlmssp sequence number */
+ DOM_CRED clnt_cred; /* Client credential. */
+
+ int max_recv_frag;
+ int max_xmit_frag;
+};
+
+struct msrpc_state
+{
+ fstring pipe_name;
+ struct user_creds usr;
+ struct ntdom_info nt;
+
+ int fd;
+ BOOL redirect;
+ BOOL initialised;
+ char *inbuf;
+ char *outbuf;
+};
#include "client.h"
#include "rpcclient.h"