summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>2000-03-10 19:53:33 +0000
committerLuke Leighton <lkcl@samba.org>2000-03-10 19:53:33 +0000
commitcfac1db9b3b26aabd8c91b14d0ceace1d8e3ea77 (patch)
tree9d151082b5a310df92a0cfd26a37e90d84cbb3d6
parent187d8f10687f294ec98fc061eb8551b6e58e49c8 (diff)
downloadsamba-cfac1db9b3b26aabd8c91b14d0ceace1d8e3ea77.tar.gz
samba-cfac1db9b3b26aabd8c91b14d0ceace1d8e3ea77.tar.xz
samba-cfac1db9b3b26aabd8c91b14d0ceace1d8e3ea77.zip
- spoolssd linked against shared libubiqx, not static.
- finaly fixed %U (at least for me), it was one line in passdb/sampass.c - started to merge some configure things from HEAD (not that we currently realy need it) - added some debugging to lsarpcd (policy-handles), so maybe we'll get those mysterious crashes with ldap; made some functions static - prs_set_offset() (from J.F.) didn't prs_grow enough. I don't know, if he needs prs_set_offset to actually grow any buffer (for marshalling), but maybe it helps - parse_samr.c cleanup: + rewrote most of the memory-things to use g_new + removed useless prs_align after smb_io_pol_hnd() + converted more memcpy(&q->pol, pol, sizeof()) to q->pol = *pol; this all made parse_samr.c about 100 lines smaller.
-rw-r--r--source/Makefile.in7
-rw-r--r--source/acconfig.h3
-rw-r--r--source/configure.in70
-rw-r--r--source/include/lib_smb_proto.h136
-rw-r--r--source/include/proto.h1310
-rw-r--r--source/include/rpc_client_proto.h2
-rw-r--r--source/include/rpc_parse_proto.h2
-rw-r--r--source/include/winbindd_proto.h556
-rw-r--r--source/lsarpcd/srv_lsa_samdb.c22
-rw-r--r--source/passdb/sampass.c5
-rw-r--r--source/rpc_parse/parse_prs.c2
-rw-r--r--source/rpc_parse/parse_samr.c298
12 files changed, 1175 insertions, 1238 deletions
diff --git a/source/Makefile.in b/source/Makefile.in
index 25cd77971ff..8b85e75608f 100644
--- a/source/Makefile.in
+++ b/source/Makefile.in
@@ -384,7 +384,8 @@ SPOOLSSD_OBJ = $(MSRPCD_OBJ) $(SPOOLSSD_OBJ1) \
$(PRINTING_OBJ) \
$(SIDDB_OBJ) \
$(RPC_SRVUTIL_OBJ) \
- $(LOCKING_OBJ) $(PROFILE_OBJ) $(UBIQX_OBJ)
+ $(LOCKING_OBJ) $(PROFILE_OBJ)
+SPOOLSSD_LIBS = $(SAMBA_LIBS) $(UBIQXLIB)
NETLOGOND_OBJ = $(MSRPCD_OBJ) $(NETLOGOND_OBJ1) \
$(RPC_SRVUTIL_OBJ) \
@@ -880,9 +881,9 @@ bin/lsarpcd: $(LSARPCD_LIBS) $(LSARPCD_OBJ) bin/.dummy
@echo Linking $@
@$(LINK) -o $@ $(LSARPCD_OBJ) $(LSARPCD_LIBS) $(LIBS)
-bin/spoolssd: $(SAMBA_LIBS) $(SPOOLSSD_OBJ) bin/.dummy
+bin/spoolssd: $(SPOOLSSD_LIBS) $(SPOOLSSD_OBJ) bin/.dummy
@echo Linking $@
- @$(LINK) -o $@ $(SPOOLSSD_OBJ) $(SAMBA_LIBS) $(LIBS)
+ @$(LINK) -o $@ $(SPOOLSSD_OBJ) $(SPOOLSSD_LIBS) $(LIBS)
bin/srvsvcd: $(SAMBA_LIBS) $(SRVSVCD_OBJ) bin/.dummy
@echo Linking $@
diff --git a/source/acconfig.h b/source/acconfig.h
index 55fd87425e5..cd9002fdff0 100644
--- a/source/acconfig.h
+++ b/source/acconfig.h
@@ -11,6 +11,7 @@
#undef loff_t
#undef offset_t
#undef aclent_t
+#undef wchar_t
#undef HAVE_CONNECT
#undef HAVE_SHORT_INO_T
#undef WITH_SMBWRAPPER
@@ -104,3 +105,5 @@
#undef USE_SETUIDX
#undef WITH_NT5LDAP
+
+#undef HAVE_VOLATILE
diff --git a/source/configure.in b/source/configure.in
index 7120421b4a0..52e19e48e00 100644
--- a/source/configure.in
+++ b/source/configure.in
@@ -6,6 +6,7 @@ AC_PREFIX_DEFAULT(/usr/local/samba)
dnl Unique-to-Samba variables we'll be playing with.
AC_SUBST(SHELL)
+AC_SUBST(RUNPROG)
AC_SUBST(MPROGS)
AC_SUBST(LDSHFLAGS)
AC_SUBST(HOST_OS)
@@ -26,6 +27,7 @@ AC_SUBST(LIBSAMBA32)
AC_SUBST(WRAP)
AC_SUBST(WRAP32)
AC_SUBST(PICFLAG)
+AC_SUBST(SHLIBEXT)
# compile with optimisation and without debugging by default
CFLAGS=${CFLAGS-"-O"}
@@ -35,6 +37,25 @@ AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_AWK
+dnl Check if C compiler understands -c and -o at the same time
+AC_PROG_CC_C_O
+if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then
+ BROKEN_CC=
+else
+ BROKEN_CC=#
+fi
+AC_SUBST(BROKEN_CC)
+
+dnl Check if the C compiler understands volatile (it should, being ANSI).
+AC_CACHE_CHECK([that the C compiler understands volatile],samba_cv_volatile, [
+ AC_TRY_COMPILE([#include <sys/types.h>],[volatile int i = 0],
+ samba_cv_volatile=yes,samba_cv_volatile=no)])
+if test x"$samba_cv_volatile" = x"yes"; then
+ AC_DEFINE(HAVE_VOLATILE)
+fi
+
+
+
AC_CANONICAL_SYSTEM
AC_VALIDATE_CACHE_SYSTEM_TYPE
SAMBA_MAINTAINER_MODE
@@ -73,10 +94,15 @@ AC_CHECK_HEADERS(sys/wait.h sys/resource.h sys/ioctl.h sys/mode.h sys/mman.h)
AC_CHECK_HEADERS(sys/filio.h string.h strings.h stdlib.h sys/socket.h sys/un.h)
AC_CHECK_HEADERS(sys/mount.h sys/vfs.h sys/fs/s5param.h sys/filsys.h termios.h)
AC_CHECK_HEADERS(sys/statfs.h sys/dustat.h sys/statvfs.h stdarg.h sys/sockio.h)
+#
AC_CHECK_HEADERS(shadow.h netinet/tcp.h sys/security.h security/pam_appl.h)
AC_CHECK_HEADERS(stropts.h poll.h readline.h history.h readline/readline.h)
AC_CHECK_HEADERS(readline/history.h sys/capability.h syscall.h sys/syscall.h)
-AC_CHECK_HEADERS(sys/acl.h sys/cdefs.h glob.h mysql.h)
+AC_CHECK_HEADERS(sys/acl.h sys/cdefs.h glob.h)
+AC_CHECK_HEADERS(mysql.h)
+
+# For experimental utmp support
+AC_CHECK_HEADERS(utmp.h utmpx.h)
AC_CHECK_SIZEOF(int,cross)
AC_CHECK_SIZEOF(long,cross)
@@ -103,6 +129,11 @@ AC_CHECK_TYPE(ino_t,unsigned)
AC_CHECK_TYPE(loff_t,off_t)
AC_CHECK_TYPE(offset_t,loff_t)
AC_CHECK_TYPE(ssize_t, int)
+AC_CHECK_TYPE(wchar_t, unsigned short)
+
+# we need libcups for CUPS support...
+AC_CHECK_LIB(cups,httpConnect)
+
AC_CACHE_CHECK([for errno in errno.h],samba_cv_errno, [
AC_TRY_COMPILE([#include <errno.h>],[int i = errno],
@@ -180,6 +211,7 @@ if test "$ac_cv_header_readline_h" = "yes" ||
fi
fi
+
# The following test taken from the cvs sources
# If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
# The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has
@@ -214,6 +246,13 @@ if test x"$ac_cv_func_connect" = x"no"; then
fi
fi
+# Check if we have execl, if not we need to compile smbrun.
+AC_CHECK_FUNCS(execl)
+if test x"$ac_cv_func_execl" = x"no"; then
+ RUNPROG="bin/smbrun"
+else
+ RUNPROG=""
+fi
AC_CHECK_FUNCS(waitpid getcwd strdup strtoul strerror chown chmod chroot)
AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync execl bzero memset)
@@ -254,6 +293,9 @@ AC_LIBTESTFUNC(sec, putprpwnam)
AC_LIBTESTFUNC(security, set_auth_parameters)
AC_LIBTESTFUNC(sec, set_auth_parameters)
+# UnixWare 7.x has its getspnam in -lgen
+AC_LIBTESTFUNC(gen, getspnam)
+
AC_LIBTESTFUNC(security, getspnam)
AC_LIBTESTFUNC(sec, getspnam)
@@ -270,6 +312,8 @@ AC_LIBTESTFUNC(sec, getprpwnam)
# these are the defaults, good for lots of systems
HOST_OS="$host_os"
LDSHFLAGS="-shared"
+PICFLAG=""
+SHLIBEXT="so"
# and these are for particular systems
case "$host_os" in
@@ -303,10 +347,9 @@ case "$host_os" in
esac
# try to work out how to produce pic code with this compiler
-PICFLAG=""
AC_PROG_CC_FLAG(fpic)
if test $ac_cv_prog_cc_fpic = yes; then
- PICFLAG="-fpic";
+ PICFLAG="-fpic";
fi
if test x$PICFLAG = x; then
AC_PROG_CC_FLAG(Kpic)
@@ -1134,6 +1177,7 @@ AC_ARG_WITH(surstdb,
AC_MSG_RESULT(no)
)
+
#################################################
# check for a LDAP password database
AC_MSG_CHECKING(whether to use LDAP password database)
@@ -1340,6 +1384,21 @@ AC_ARG_WITH(quotas,
AC_SUBST(QUOTAOBJS)
#################################################
+# check for experimental utmp accounting
+
+#################################################
+# check for MS Dfs support
+
+#################################################
+# set private directory location
+
+#################################################
+# set lock directory location
+
+#################################################
+# set SWAT directory location
+
+#################################################
# these tests are taken from the GNU fileutils package
AC_CHECKING(how to get filesystem space usage)
space=no
@@ -1349,12 +1408,15 @@ if test $space = no; then
# SVR4
AC_CACHE_CHECK([statvfs64 function (SVR4)], fu_cv_sys_stat_statvfs64,
[AC_TRY_RUN([
+#if defined(HAVE_UNISTD_H)
+#include <unistd.h>
+#endif
#include <sys/types.h>
#include <sys/statvfs.h>
main ()
{
struct statvfs64 fsd;
- exit (statfs64 (".", &fsd));
+ exit (statvfs64 (".", &fsd));
}],
fu_cv_sys_stat_statvfs64=yes,
fu_cv_sys_stat_statvfs64=no,
diff --git a/source/include/lib_smb_proto.h b/source/include/lib_smb_proto.h
index ed94d1e16f3..cef7fe043b6 100644
--- a/source/include/lib_smb_proto.h
+++ b/source/include/lib_smb_proto.h
@@ -23,6 +23,74 @@ void MD5Update(struct MD5Context *ctx, uchar const *buf, unsigned len);
void MD5Final(uchar digest[16], struct MD5Context *ctx);
void MD5Transform(uint32 buf[4], const uchar inext[64]);
+/*The following definitions come from lib/util_hnd.c */
+
+struct policy_cache *get_global_hnd_cache(void);
+struct policy_cache *init_policy_cache(int num_pol_hnds);
+void free_policy_cache(struct policy_cache *cache);
+BOOL policy_hnd_set_name(struct policy_cache *cache,
+ POLICY_HND *hnd, const char *name);
+const char *policy_hnd_get_name(struct policy_cache *cache,
+ const POLICY_HND *hnd);
+BOOL dup_policy_hnd(struct policy_cache *cache,
+ POLICY_HND *hnd,
+ const POLICY_HND *from);
+BOOL register_policy_hnd(struct policy_cache *cache,
+ const vuser_key *key,
+ POLICY_HND *hnd,
+ uint32 access_mask);
+BOOL open_policy_hnd(struct policy_cache *cache,
+ const vuser_key *key,
+ POLICY_HND *hnd,
+ uint32 access_mask);
+BOOL open_policy_hnd_link(struct policy_cache *cache,
+ const POLICY_HND *parent_hnd,
+ POLICY_HND *hnd,
+ uint32 access_mask);
+int find_policy_by_hnd(struct policy_cache *cache, const POLICY_HND *hnd);
+BOOL set_policy_state(struct policy_cache *cache, POLICY_HND *hnd,
+ void(*fn)(void*), void *dev);
+void *get_policy_state_info(struct policy_cache *cache, const POLICY_HND *hnd);
+BOOL policy_hnd_set_state_type(struct policy_cache *cache,
+ POLICY_HND *hnd, int type);
+int policy_hnd_get_state_type(struct policy_cache *cache,
+ const POLICY_HND *hnd);
+BOOL policy_hnd_check_state_type(struct policy_cache *cache,
+ const POLICY_HND *hnd, int type);
+BOOL close_policy_hnd(struct policy_cache *cache, POLICY_HND *hnd);
+BOOL policy_link_key(struct policy_cache *cache, const POLICY_HND *hnd,
+ POLICY_HND *to);
+const vuser_key *get_policy_vuser_key(struct policy_cache *cache,
+ const POLICY_HND *hnd);
+BOOL pol_get_usr_sesskey(struct policy_cache *cache, const POLICY_HND *hnd,
+ uchar usr_sess_key[16]);
+
+/*The following definitions come from lib/vuser.c */
+
+BOOL is_valid_user_struct(const vuser_key * key);
+user_struct *get_valid_user_struct(const vuser_key * key);
+void invalidate_vuid(vuser_key * key);
+BOOL validated_username(vuser_key * key, char *name, size_t len);
+uint16 create_vuid(pid_t pid,
+ uid_t uid, gid_t gid,
+ int n_groups, gid_t * groups,
+ const char *unix_name,
+ const char *requested_name,
+ const char *real_name,
+ BOOL guest, const NET_USER_INFO_3 * info3);
+uint16 register_vuid(pid_t pid, uid_t uid, gid_t gid,
+ const char *unix_name,
+ const char *requested_name,
+ BOOL guest, const NET_USER_INFO_3 * info3);
+BOOL check_vuser_ok(struct uid_cache *cache, user_struct * vuser, int snum);
+
+/*The following definitions come from lib/vuser_db.c */
+
+BOOL tdb_delete_vuid( const vuser_key *uk);
+BOOL tdb_lookup_vuid( const vuser_key *uk, user_struct **usr);
+BOOL tdb_store_vuid( const vuser_key *uk, user_struct *usr);
+BOOL vuid_init_db(void);
+
/*The following definitions come from libsmb/clientgen.c */
int cli_set_port(struct cli_state *cli, int port);
@@ -240,74 +308,6 @@ BOOL smb_safe_err_msg(uint8 class, uint32 num, char *ret, size_t len);
BOOL smb_safe_errstr(char *inbuf, char *msg, size_t len);
char *smb_errstr(char *inbuf);
-/*The following definitions come from lib/util_hnd.c */
-
-struct policy_cache *get_global_hnd_cache(void);
-struct policy_cache *init_policy_cache(int num_pol_hnds);
-void free_policy_cache(struct policy_cache *cache);
-BOOL policy_hnd_set_name(struct policy_cache *cache,
- POLICY_HND *hnd, const char *name);
-const char *policy_hnd_get_name(struct policy_cache *cache,
- const POLICY_HND *hnd);
-BOOL dup_policy_hnd(struct policy_cache *cache,
- POLICY_HND *hnd,
- const POLICY_HND *from);
-BOOL register_policy_hnd(struct policy_cache *cache,
- const vuser_key *key,
- POLICY_HND *hnd,
- uint32 access_mask);
-BOOL open_policy_hnd(struct policy_cache *cache,
- const vuser_key *key,
- POLICY_HND *hnd,
- uint32 access_mask);
-BOOL open_policy_hnd_link(struct policy_cache *cache,
- const POLICY_HND *parent_hnd,
- POLICY_HND *hnd,
- uint32 access_mask);
-int find_policy_by_hnd(struct policy_cache *cache, const POLICY_HND *hnd);
-BOOL set_policy_state(struct policy_cache *cache, POLICY_HND *hnd,
- void(*fn)(void*), void *dev);
-void *get_policy_state_info(struct policy_cache *cache, const POLICY_HND *hnd);
-BOOL policy_hnd_set_state_type(struct policy_cache *cache,
- POLICY_HND *hnd, int type);
-int policy_hnd_get_state_type(struct policy_cache *cache,
- const POLICY_HND *hnd);
-BOOL policy_hnd_check_state_type(struct policy_cache *cache,
- const POLICY_HND *hnd, int type);
-BOOL close_policy_hnd(struct policy_cache *cache, POLICY_HND *hnd);
-BOOL policy_link_key(struct policy_cache *cache, const POLICY_HND *hnd,
- POLICY_HND *to);
-const vuser_key *get_policy_vuser_key(struct policy_cache *cache,
- const POLICY_HND *hnd);
-BOOL pol_get_usr_sesskey(struct policy_cache *cache, const POLICY_HND *hnd,
- uchar usr_sess_key[16]);
-
-/*The following definitions come from lib/vuser.c */
-
-BOOL is_valid_user_struct(const vuser_key * key);
-user_struct *get_valid_user_struct(const vuser_key * key);
-void invalidate_vuid(vuser_key * key);
-BOOL validated_username(vuser_key * key, char *name, size_t len);
-uint16 create_vuid(pid_t pid,
- uid_t uid, gid_t gid,
- int n_groups, gid_t * groups,
- const char *unix_name,
- const char *requested_name,
- const char *real_name,
- BOOL guest, const NET_USER_INFO_3 * info3);
-uint16 register_vuid(pid_t pid, uid_t uid, gid_t gid,
- const char *unix_name,
- const char *requested_name,
- BOOL guest, const NET_USER_INFO_3 * info3);
-BOOL check_vuser_ok(struct uid_cache *cache, user_struct * vuser, int snum);
-
-/*The following definitions come from lib/vuser_db.c */
-
-BOOL tdb_delete_vuid( const vuser_key *uk);
-BOOL tdb_lookup_vuid( const vuser_key *uk, user_struct **usr);
-BOOL tdb_store_vuid( const vuser_key *uk, user_struct *usr);
-BOOL vuid_init_db(void);
-
/*The following definitions come from rpc_parse/parse_creds.c */
BOOL make_creds_unix(CREDS_UNIX *r_u, const char* user_name,
diff --git a/source/include/proto.h b/source/include/proto.h
index a0d3587f32d..9a5e0945380 100644
--- a/source/include/proto.h
+++ b/source/include/proto.h
@@ -388,269 +388,10 @@ void CatchChildLeaveStatus(void);
int vslprintf(char *str, int n, char *format, va_list ap);
-/*The following definitions come from libsmb/clientgen.c */
-
-int cli_set_port(struct cli_state *cli, int port);
-char *cli_errstr(struct cli_state *cli);
-void cli_safe_smb_errstr(struct cli_state *cli, char *msg, size_t len);
-BOOL get_safe_rap_errstr(int rap_error, char *err_msg, size_t msglen);
-void cli_safe_errstr(struct cli_state *cli, char *err_msg, size_t msglen);
-BOOL cli_send_trans(struct cli_state *cli, int trans,
- char *name, int pipe_name_len,
- int fid, int flags,
- uint16 *setup, int lsetup, int msetup,
- char *param, int lparam, int mparam,
- char *data, int ldata, int mdata);
-BOOL cli_api_pipe(struct cli_state *cli, char *pipe_name, int pipe_name_len,
- uint16 *setup, uint32 setup_count, uint32 max_setup_count,
- char *params, uint32 param_count, uint32 max_param_count,
- char *data, uint32 data_count, uint32 max_data_count,
- char **rparam, uint32 *rparam_count,
- char **rdata, uint32 *rdata_count);
-BOOL cli_api(struct cli_state *cli,
- char *param, int prcnt, int mprcnt,
- char *data, int drcnt, int mdrcnt,
- char **rparam, int *rprcnt,
- char **rdata, int *rdrcnt);
-BOOL cli_NetWkstaUserLogon(struct cli_state *cli,char *user, char *workstation);
-BOOL cli_RNetShareEnum(struct cli_state *cli, void (*fn)(const char *, uint32, const char *));
-BOOL cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype,
- void (*fn)(const char *, uint32, const char *));
-BOOL cli_session_setup_x(struct cli_state *cli,
- char *user,
- char *pass, int passlen,
- char *ntpass, int ntpasslen,
- char *user_domain);
-BOOL cli_session_setup(struct cli_state *cli,
- char *myhostname, char *user,
- char *pass, int passlen,
- char *ntpass, int ntpasslen,
- char *user_domain);
-BOOL cli_ulogoff(struct cli_state *cli);
-BOOL cli_send_tconX(struct cli_state *cli,
- char *share, char *dev, char *pass, int passlen);
-BOOL cli_tdis(struct cli_state *cli);
-BOOL cli_rename(struct cli_state *cli, char *fname_src, char *fname_dst);
-BOOL cli_unlink(struct cli_state *cli, char *fname);
-BOOL cli_mkdir(struct cli_state *cli, char *dname);
-BOOL cli_rmdir(struct cli_state *cli, char *dname);
-int cli_nt_create(struct cli_state *cli, const char *fname);
-int cli_open(struct cli_state *cli, const char *fname,
- int flags, int share_mode);
-BOOL cli_close(struct cli_state *cli, int fnum);
-BOOL cli_lock(struct cli_state *cli, int fnum, uint32 offset, uint32 len, int timeout);
-BOOL cli_unlock(struct cli_state *cli, int fnum, uint32 offset, uint32 len, int timeout);
-size_t cli_read_one(struct cli_state *cli, int fnum, char *buf, off_t offset, size_t size);
-size_t cli_read(struct cli_state *cli, int fnum, char *buf, off_t offset, size_t size, BOOL overlap);
-ssize_t cli_write(struct cli_state *cli,
- int fnum, uint16 write_mode,
- char *buf, off_t offset, size_t size, size_t bytes_left);
-BOOL cli_getattrE(struct cli_state *cli, int fd,
- uint16 *attr, size_t *size,
- time_t *c_time, time_t *a_time, time_t *m_time);
-BOOL cli_getatr(struct cli_state *cli, char *fname,
- uint16 *attr, size_t *size, time_t *t);
-BOOL cli_setatr(struct cli_state *cli, char *fname, uint16 attr, time_t t);
-BOOL cli_qpathinfo(struct cli_state *cli, const char *fname,
- time_t *c_time, time_t *a_time, time_t *m_time,
- size_t *size, uint16 *mode);
-BOOL cli_qpathinfo2(struct cli_state *cli, const char *fname,
- time_t *c_time, time_t *a_time, time_t *m_time,
- time_t *w_time, size_t *size, uint16 *mode,
- SMB_INO_T *ino);
-BOOL cli_qfileinfo(struct cli_state *cli, int fnum,
- uint16 *mode, size_t *size,
- time_t *c_time, time_t *a_time, time_t *m_time,
- time_t *w_time, SMB_INO_T *ino);
-int cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
- void (*fn)(file_info *, const char *));
-BOOL cli_oem_change_password(struct cli_state *cli, const char *user, const char *new_password,
- const char *old_password);
-BOOL cli_negprot(struct cli_state *cli);
-BOOL cli_session_request(struct cli_state *cli,
- struct nmb_name *calling, struct nmb_name *called);
-BOOL cli_connect(struct cli_state *cli, const char *host, struct in_addr *ip);
-void cli_init_creds(struct cli_state *cli, const struct ntuser_creds *usr);
-struct cli_state *cli_initialise(struct cli_state *cli);
-void cli_close_socket(struct cli_state *cli);
-void cli_shutdown(struct cli_state *cli);
-int cli_error(struct cli_state *cli, uint8 *eclass, uint32 *num);
-void cli_sockopt(struct cli_state *cli, char *options);
-uint16 cli_setpid(struct cli_state *cli, uint16 pid);
-BOOL cli_reestablish_connection(struct cli_state *cli);
-BOOL cli_establish_connection(struct cli_state *cli,
- const char *dest_host, struct in_addr *dest_ip,
- struct nmb_name *calling, struct nmb_name *called,
- char *service, char *service_type,
- BOOL do_shutdown, BOOL do_tcon);
-BOOL cli_connect_auth(struct cli_state *cli,
- const char* desthost,
- struct in_addr *dest_ip,
- const struct ntuser_creds *usr);
-BOOL cli_connect_servers_auth(struct cli_state *cli,
- char *p,
- const struct ntuser_creds *usr);
-BOOL cli_connect_serverlist(struct cli_state *cli, char *p);
-int cli_printjob_del(struct cli_state *cli, int job);
-int cli_print_queue(struct cli_state *cli,
- void (*fn)(struct print_job_info *));
-BOOL cli_chkpath(struct cli_state *cli, char *path);
-BOOL cli_message_start(struct cli_state *cli, char *host, char *username,
- int *grp);
-BOOL cli_message_text(struct cli_state *cli, char *msg, int len, int grp);
-BOOL cli_message_end(struct cli_state *cli, int grp);
-BOOL cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
-BOOL get_any_dc_name(const char *domain, char *srv_name);
-
-/*The following definitions come from libsmb/credentials.c */
-
-char *credstr(const uchar *cred);
-void cred_session_key(DOM_CHAL *clnt_chal, DOM_CHAL *srv_chal, const char *pass,
- uchar session_key[8]);
-void cred_create(uchar session_key[8], DOM_CHAL *stor_cred, UTIME timestamp,
- DOM_CHAL *cred);
-int cred_assert(const DOM_CHAL *cred, uchar session_key[8],
- DOM_CHAL *stored_cred, UTIME timestamp);
-BOOL clnt_deal_with_creds(uchar sess_key[8],
- DOM_CRED *sto_clnt_cred, DOM_CRED *rcv_srv_cred);
-BOOL deal_with_creds(uchar sess_key[8],
- DOM_CRED *sto_clnt_cred,
- const DOM_CRED *rcv_clnt_cred, DOM_CRED *rtn_srv_cred);
-
-/*The following definitions come from libsmb/namequery.c */
-
-BOOL name_status(int fd,char *name,int name_type,BOOL recurse,
- struct in_addr to_ip,char *master,char *rname,
- void (*fn)(struct packet_struct *));
-struct in_addr *name_query(int fd,const char *name,int name_type, BOOL bcast,BOOL recurse,
- struct in_addr to_ip, int *count, void (*fn)(struct packet_struct *));
-FILE *startlmhosts(char *fname);
-BOOL getlmhostsent( FILE *fp, pstring name, int *name_type, struct in_addr *ipaddr);
-void endlmhosts(FILE *fp);
-BOOL is_ip_address(const char *name);
-BOOL resolve_name(const char *name, struct in_addr *return_ip, int name_type);
-BOOL resolve_srv_name(const char* srv_name, fstring dest_host,
- struct in_addr *ip);
-BOOL find_master_ip(char *group, struct in_addr *master_ip);
-
-/*The following definitions come from libsmb/nmblib.c */
-
-void debug_nmb_packet(struct packet_struct *p);
-char *nmb_namestr(struct nmb_name *n);
-void nmb_safe_namestr(struct nmb_name *n, char *str, size_t len);
-struct packet_struct *copy_packet(struct packet_struct *packet);
-void free_packet(struct packet_struct *packet);
-struct packet_struct *read_packet(int fd,enum packet_type packet_type);
-void make_nmb_name( struct nmb_name *n, const char *name, int type, const char *this_scope );
-BOOL nmb_name_equal(struct nmb_name *n1, struct nmb_name *n2);
-BOOL send_packet(struct packet_struct *p);
-struct packet_struct *receive_packet(int fd,enum packet_type type,int t);
-void sort_query_replies(char *data, int n, struct in_addr ip);
-BOOL read_nmb_sock(int c, struct nmb_state *con);
-int get_nmb_sock(void);
-char *dns_to_netbios_name(char *dns_name);
-int name_mangle( char *In, char *Out, char name_type );
-int name_extract(char *buf,int ofs,char *name);
-int name_len(char *s1);
-
-/*The following definitions come from libsmb/nterr.c */
-
-BOOL get_safe_nt_error_msg(uint32 nt_code, char *msg, size_t len);
-const char *get_nt_error_msg(uint32 nt_code);
-
-/*The following definitions come from libsmb/passchange.c */
-
-BOOL remote_password_change(const char *remote_machine, const char *user_name,
- const char *old_passwd, const char *new_passwd,
- char *err_str, size_t err_str_len);
-
-/*The following definitions come from libsmb/pwd_cache.c */
-
-void pwd_init(struct pwd_info *pwd);
-BOOL pwd_is_nullpwd(const struct pwd_info *pwd);
-void pwd_obfuscate_key(struct pwd_info *pwd, uint32 int_key, char *str_key);
-BOOL pwd_compare(const struct pwd_info *_pwd1, const 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);
-void pwd_get_cleartext(struct pwd_info *pwd, char *clr);
-void pwd_set_lm_nt_16(struct pwd_info *pwd,
- const uchar lm_pwd[16],
- const uchar nt_pwd[16]);
-void pwd_get_lm_nt_16(const struct pwd_info *pwd, uchar lm_pwd[16], uchar nt_pwd[16]);
-void pwd_make_lm_nt_16(struct pwd_info *pwd, char *clr);
-void pwd_make_lm_nt_owf2(struct pwd_info *pwd, const uchar srv_key[8],
- const char *user, const char *server, const char *domain,
- uchar sess_key[16]);
-void pwd_make_lm_nt_owf(struct pwd_info *pwd, uchar cryptkey[8],
- uchar sess_key[16]);
-void pwd_get_lm_nt_owf(struct pwd_info *pwd, uchar lm_owf[24],
- uchar *nt_owf, size_t *nt_owf_len);
-
/*The following definitions come from lib/smbrun.c */
int smbrun(char *cmd,char *outfile,BOOL shared);
-/*The following definitions come from libsmb/smbdes.c */
-
-void smbhash(uchar *out, const uchar *in, const uchar *key, int forw);
-void E_P16(uchar *p14,uchar *p16);
-void E_P24(const uchar *p21, const uchar *c8, uchar *p24);
-void D_P16(const uchar *p14, const uchar *in, uchar *out);
-void E_old_pw_hash( const uchar *p14, const uchar *in, uchar *out);
-void cred_hash1(uchar *out, const uchar *in, const uchar *key);
-void cred_hash2(uchar *out,uchar *in,uchar *key);
-void cred_hash3(uchar *out, const uchar *in,uchar *key, int forw);
-void SamOEMhash( uchar *data, const uchar *key, int val);
-void sam_pwd_hash(uint32 rid, const uchar *in, uchar *out, int forw);
-
-/*The following definitions come from libsmb/smbencrypt.c */
-
-void SMBencrypt(uchar * pwrd, uchar * c8, uchar * p24);
-void SMBNTencrypt(uchar * pwrd, uchar * c8, uchar * p24);
-void E_md4hash(uchar * pwrd, uchar * p16);
-void lm_owf_genW(const UNISTR2 * pwd, uchar p16[16]);
-void lm_owf_gen(const char *pwd, uchar p16[16]);
-void nt_owf_genW(const UNISTR2 * pwd, uchar nt_p16[16]);
-void nt_owf_gen(const char *pwd, uchar nt_p16[16]);
-void nt_lm_owf_genW(const UNISTR2 * pwd, uchar nt_p16[16], uchar lm_p16[16]);
-void nt_lm_owf_gen(const char *pwd, uchar nt_p16[16], uchar lm_p16[16]);
-void SMBOWFencrypt(const uchar pwrd[16], const uchar * c8, uchar p24[24]);
-void SMBOWFencrypt_ntv2(const uchar kr[16],
- const uchar * srv_chal, int srv_chal_len,
- const uchar * cli_chal, int cli_chal_len,
- char resp_buf[16]);
-void SMBsesskeygen_ntv2(const uchar kr[16],
- const uchar * nt_resp, char sess_key[16]);
-void SMBsesskeygen_ntv1(const uchar kr[16],
- const uchar * nt_resp, char sess_key[16]);
-void SMBgenclientchals(char *lm_cli_chal,
- char *nt_cli_chal, int *nt_cli_chal_len,
- const char *srv, const char *dom);
-void ntv2_owf_gen(const uchar owf[16],
- const char *user_n, const char *domain_n, uchar kr_buf[16]);
-void NTLMSSPOWFencrypt(const uchar pwrd[8], const uchar * ntlmchalresp,
- uchar p24[24]);
-BOOL make_oem_passwd_hash(uchar data[516],
- const char *pwrd, int new_pw_len,
- const uchar old_pw_hash[16], BOOL unicode);
-BOOL nt_encrypt_string2(STRING2 * out, const STRING2 * in, const uchar * key);
-BOOL nt_decrypt_string2(STRING2 * out, const STRING2 * in, const uchar * key);
-void create_ntlmssp_resp(struct pwd_info *pwd,
- char *domain, char *user_name, char *my_name,
- uint32 ntlmssp_cli_flgs, prs_struct * auth_resp);
-BOOL decode_pw_buffer(const char buffer[516], char *new_pwrd,
- int new_pwrd_size, uint32 * new_pw_len);
-BOOL encode_pw_buffer(char buffer[516], const char *new_pass,
- int new_pw_len, BOOL nt_pass_set);
-
-/*The following definitions come from libsmb/smberr.c */
-
-char *smb_err_msg(uint8 class, uint32 num);
-BOOL smb_safe_err_msg(uint8 class, uint32 num, char *ret, size_t len);
-BOOL smb_safe_errstr(char *inbuf, char *msg, size_t len);
-char *smb_errstr(char *inbuf);
-
/*The following definitions come from lib/snprintf.c */
@@ -660,6 +401,11 @@ void become_root(BOOL save_dir);
void unbecome_root(BOOL restore_dir);
const vuser_key *get_sec_ctx(void);
+/*The following definitions come from lib/surs.c */
+
+BOOL surs_sam_sid_to_unixid(DOM_SID *sid, uint32 type, uint32 *id, BOOL create);
+BOOL surs_unixid_to_sam_sid(uint32 id, uint32 type, DOM_SID *sid, BOOL create);
+
/*The following definitions come from lib/sursalgdomonly.c */
BOOL surs_algdomonly_sam_sid_to_unixid(DOM_SID *sid, uint32 type, uint32 *id,
@@ -674,11 +420,6 @@ BOOL surs_nt5ldap_sam_sid_to_unixid(LDAPDB *hds, DOM_SID * sid, uint32 type,
BOOL surs_nt5ldap_unixid_to_sam_sid(LDAPDB *hds, uint32 id, uint32 type,
DOM_SID * sid, BOOL create);
-/*The following definitions come from lib/surs.c */
-
-BOOL surs_sam_sid_to_unixid(DOM_SID *sid, uint32 type, uint32 *id, BOOL create);
-BOOL surs_unixid_to_sam_sid(uint32 id, uint32 type, DOM_SID *sid, BOOL create);
-
/*The following definitions come from lib/surstdb.c */
BOOL surs_tdb_sam_sid_to_unixid(DOM_SID * sid, uint32 type, uint32 * id,
@@ -751,25 +492,6 @@ const struct passwd *Get_Pwnam(char *user,BOOL allow_change);
BOOL user_ok(char *user,int snum);
BOOL user_in_list(char *user,char *list);
-/*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_unistr_array(uint32 num_entries, UNISTR2 **entries);
-UNISTR2* add_unistr_to_array(uint32 *len, UNISTR2 ***array, UNISTR2 *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.c */
BOOL init_myworkgroup(void);
@@ -877,6 +599,25 @@ char *passdb_path(char *name);
char *lock_path(char *name);
const char *get_sid_name_use_str(uint32 sid_name_use);
+/*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_unistr_array(uint32 num_entries, UNISTR2 **entries);
+UNISTR2* add_unistr_to_array(uint32 *len, UNISTR2 ***array, UNISTR2 *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);
@@ -1110,6 +851,265 @@ BOOL tdb_lookup_vuid( const vuser_key *uk, user_struct **usr);
BOOL tdb_store_vuid( const vuser_key *uk, user_struct *usr);
BOOL vuid_init_db(void);
+/*The following definitions come from libsmb/clientgen.c */
+
+int cli_set_port(struct cli_state *cli, int port);
+char *cli_errstr(struct cli_state *cli);
+void cli_safe_smb_errstr(struct cli_state *cli, char *msg, size_t len);
+BOOL get_safe_rap_errstr(int rap_error, char *err_msg, size_t msglen);
+void cli_safe_errstr(struct cli_state *cli, char *err_msg, size_t msglen);
+BOOL cli_send_trans(struct cli_state *cli, int trans,
+ char *name, int pipe_name_len,
+ int fid, int flags,
+ uint16 *setup, int lsetup, int msetup,
+ char *param, int lparam, int mparam,
+ char *data, int ldata, int mdata);
+BOOL cli_api_pipe(struct cli_state *cli, char *pipe_name, int pipe_name_len,
+ uint16 *setup, uint32 setup_count, uint32 max_setup_count,
+ char *params, uint32 param_count, uint32 max_param_count,
+ char *data, uint32 data_count, uint32 max_data_count,
+ char **rparam, uint32 *rparam_count,
+ char **rdata, uint32 *rdata_count);
+BOOL cli_api(struct cli_state *cli,
+ char *param, int prcnt, int mprcnt,
+ char *data, int drcnt, int mdrcnt,
+ char **rparam, int *rprcnt,
+ char **rdata, int *rdrcnt);
+BOOL cli_NetWkstaUserLogon(struct cli_state *cli,char *user, char *workstation);
+BOOL cli_RNetShareEnum(struct cli_state *cli, void (*fn)(const char *, uint32, const char *));
+BOOL cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype,
+ void (*fn)(const char *, uint32, const char *));
+BOOL cli_session_setup_x(struct cli_state *cli,
+ char *user,
+ char *pass, int passlen,
+ char *ntpass, int ntpasslen,
+ char *user_domain);
+BOOL cli_session_setup(struct cli_state *cli,
+ char *myhostname, char *user,
+ char *pass, int passlen,
+ char *ntpass, int ntpasslen,
+ char *user_domain);
+BOOL cli_ulogoff(struct cli_state *cli);
+BOOL cli_send_tconX(struct cli_state *cli,
+ char *share, char *dev, char *pass, int passlen);
+BOOL cli_tdis(struct cli_state *cli);
+BOOL cli_rename(struct cli_state *cli, char *fname_src, char *fname_dst);
+BOOL cli_unlink(struct cli_state *cli, char *fname);
+BOOL cli_mkdir(struct cli_state *cli, char *dname);
+BOOL cli_rmdir(struct cli_state *cli, char *dname);
+int cli_nt_create(struct cli_state *cli, const char *fname);
+int cli_open(struct cli_state *cli, const char *fname,
+ int flags, int share_mode);
+BOOL cli_close(struct cli_state *cli, int fnum);
+BOOL cli_lock(struct cli_state *cli, int fnum, uint32 offset, uint32 len, int timeout);
+BOOL cli_unlock(struct cli_state *cli, int fnum, uint32 offset, uint32 len, int timeout);
+size_t cli_read_one(struct cli_state *cli, int fnum, char *buf, off_t offset, size_t size);
+size_t cli_read(struct cli_state *cli, int fnum, char *buf, off_t offset, size_t size, BOOL overlap);
+ssize_t cli_write(struct cli_state *cli,
+ int fnum, uint16 write_mode,
+ char *buf, off_t offset, size_t size, size_t bytes_left);
+BOOL cli_getattrE(struct cli_state *cli, int fd,
+ uint16 *attr, size_t *size,
+ time_t *c_time, time_t *a_time, time_t *m_time);
+BOOL cli_getatr(struct cli_state *cli, char *fname,
+ uint16 *attr, size_t *size, time_t *t);
+BOOL cli_setatr(struct cli_state *cli, char *fname, uint16 attr, time_t t);
+BOOL cli_qpathinfo(struct cli_state *cli, const char *fname,
+ time_t *c_time, time_t *a_time, time_t *m_time,
+ size_t *size, uint16 *mode);
+BOOL cli_qpathinfo2(struct cli_state *cli, const char *fname,
+ time_t *c_time, time_t *a_time, time_t *m_time,
+ time_t *w_time, size_t *size, uint16 *mode,
+ SMB_INO_T *ino);
+BOOL cli_qfileinfo(struct cli_state *cli, int fnum,
+ uint16 *mode, size_t *size,
+ time_t *c_time, time_t *a_time, time_t *m_time,
+ time_t *w_time, SMB_INO_T *ino);
+int cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
+ void (*fn)(file_info *, const char *));
+BOOL cli_oem_change_password(struct cli_state *cli, const char *user, const char *new_password,
+ const char *old_password);
+BOOL cli_negprot(struct cli_state *cli);
+BOOL cli_session_request(struct cli_state *cli,
+ struct nmb_name *calling, struct nmb_name *called);
+BOOL cli_connect(struct cli_state *cli, const char *host, struct in_addr *ip);
+void cli_init_creds(struct cli_state *cli, const struct ntuser_creds *usr);
+struct cli_state *cli_initialise(struct cli_state *cli);
+void cli_close_socket(struct cli_state *cli);
+void cli_shutdown(struct cli_state *cli);
+int cli_error(struct cli_state *cli, uint8 *eclass, uint32 *num);
+void cli_sockopt(struct cli_state *cli, char *options);
+uint16 cli_setpid(struct cli_state *cli, uint16 pid);
+BOOL cli_reestablish_connection(struct cli_state *cli);
+BOOL cli_establish_connection(struct cli_state *cli,
+ const char *dest_host, struct in_addr *dest_ip,
+ struct nmb_name *calling, struct nmb_name *called,
+ char *service, char *service_type,
+ BOOL do_shutdown, BOOL do_tcon);
+BOOL cli_connect_auth(struct cli_state *cli,
+ const char* desthost,
+ struct in_addr *dest_ip,
+ const struct ntuser_creds *usr);
+BOOL cli_connect_servers_auth(struct cli_state *cli,
+ char *p,
+ const struct ntuser_creds *usr);
+BOOL cli_connect_serverlist(struct cli_state *cli, char *p);
+int cli_printjob_del(struct cli_state *cli, int job);
+int cli_print_queue(struct cli_state *cli,
+ void (*fn)(struct print_job_info *));
+BOOL cli_chkpath(struct cli_state *cli, char *path);
+BOOL cli_message_start(struct cli_state *cli, char *host, char *username,
+ int *grp);
+BOOL cli_message_text(struct cli_state *cli, char *msg, int len, int grp);
+BOOL cli_message_end(struct cli_state *cli, int grp);
+BOOL cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
+BOOL get_any_dc_name(const char *domain, char *srv_name);
+
+/*The following definitions come from libsmb/credentials.c */
+
+char *credstr(const uchar *cred);
+void cred_session_key(DOM_CHAL *clnt_chal, DOM_CHAL *srv_chal, const char *pass,
+ uchar session_key[8]);
+void cred_create(uchar session_key[8], DOM_CHAL *stor_cred, UTIME timestamp,
+ DOM_CHAL *cred);
+int cred_assert(const DOM_CHAL *cred, uchar session_key[8],
+ DOM_CHAL *stored_cred, UTIME timestamp);
+BOOL clnt_deal_with_creds(uchar sess_key[8],
+ DOM_CRED *sto_clnt_cred, DOM_CRED *rcv_srv_cred);
+BOOL deal_with_creds(uchar sess_key[8],
+ DOM_CRED *sto_clnt_cred,
+ const DOM_CRED *rcv_clnt_cred, DOM_CRED *rtn_srv_cred);
+
+/*The following definitions come from libsmb/namequery.c */
+
+BOOL name_status(int fd,char *name,int name_type,BOOL recurse,
+ struct in_addr to_ip,char *master,char *rname,
+ void (*fn)(struct packet_struct *));
+struct in_addr *name_query(int fd,const char *name,int name_type, BOOL bcast,BOOL recurse,
+ struct in_addr to_ip, int *count, void (*fn)(struct packet_struct *));
+FILE *startlmhosts(char *fname);
+BOOL getlmhostsent( FILE *fp, pstring name, int *name_type, struct in_addr *ipaddr);
+void endlmhosts(FILE *fp);
+BOOL is_ip_address(const char *name);
+BOOL resolve_name(const char *name, struct in_addr *return_ip, int name_type);
+BOOL resolve_srv_name(const char* srv_name, fstring dest_host,
+ struct in_addr *ip);
+BOOL find_master_ip(char *group, struct in_addr *master_ip);
+
+/*The following definitions come from libsmb/nmblib.c */
+
+void debug_nmb_packet(struct packet_struct *p);
+char *nmb_namestr(struct nmb_name *n);
+void nmb_safe_namestr(struct nmb_name *n, char *str, size_t len);
+struct packet_struct *copy_packet(struct packet_struct *packet);
+void free_packet(struct packet_struct *packet);
+struct packet_struct *read_packet(int fd,enum packet_type packet_type);
+void make_nmb_name( struct nmb_name *n, const char *name, int type, const char *this_scope );
+BOOL nmb_name_equal(struct nmb_name *n1, struct nmb_name *n2);
+BOOL send_packet(struct packet_struct *p);
+struct packet_struct *receive_packet(int fd,enum packet_type type,int t);
+void sort_query_replies(char *data, int n, struct in_addr ip);
+BOOL read_nmb_sock(int c, struct nmb_state *con);
+int get_nmb_sock(void);
+char *dns_to_netbios_name(char *dns_name);
+int name_mangle( char *In, char *Out, char name_type );
+int name_extract(char *buf,int ofs,char *name);
+int name_len(char *s1);
+
+/*The following definitions come from libsmb/nterr.c */
+
+BOOL get_safe_nt_error_msg(uint32 nt_code, char *msg, size_t len);
+const char *get_nt_error_msg(uint32 nt_code);
+
+/*The following definitions come from libsmb/passchange.c */
+
+BOOL remote_password_change(const char *remote_machine, const char *user_name,
+ const char *old_passwd, const char *new_passwd,
+ char *err_str, size_t err_str_len);
+
+/*The following definitions come from libsmb/pwd_cache.c */
+
+void pwd_init(struct pwd_info *pwd);
+BOOL pwd_is_nullpwd(const struct pwd_info *pwd);
+void pwd_obfuscate_key(struct pwd_info *pwd, uint32 int_key, char *str_key);
+BOOL pwd_compare(const struct pwd_info *_pwd1, const 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);
+void pwd_get_cleartext(struct pwd_info *pwd, char *clr);
+void pwd_set_lm_nt_16(struct pwd_info *pwd,
+ const uchar lm_pwd[16],
+ const uchar nt_pwd[16]);
+void pwd_get_lm_nt_16(const struct pwd_info *pwd, uchar lm_pwd[16], uchar nt_pwd[16]);
+void pwd_make_lm_nt_16(struct pwd_info *pwd, char *clr);
+void pwd_make_lm_nt_owf2(struct pwd_info *pwd, const uchar srv_key[8],
+ const char *user, const char *server, const char *domain,
+ uchar sess_key[16]);
+void pwd_make_lm_nt_owf(struct pwd_info *pwd, uchar cryptkey[8],
+ uchar sess_key[16]);
+void pwd_get_lm_nt_owf(struct pwd_info *pwd, uchar lm_owf[24],
+ uchar *nt_owf, size_t *nt_owf_len);
+
+/*The following definitions come from libsmb/smbdes.c */
+
+void smbhash(uchar *out, const uchar *in, const uchar *key, int forw);
+void E_P16(uchar *p14,uchar *p16);
+void E_P24(const uchar *p21, const uchar *c8, uchar *p24);
+void D_P16(const uchar *p14, const uchar *in, uchar *out);
+void E_old_pw_hash( const uchar *p14, const uchar *in, uchar *out);
+void cred_hash1(uchar *out, const uchar *in, const uchar *key);
+void cred_hash2(uchar *out,uchar *in,uchar *key);
+void cred_hash3(uchar *out, const uchar *in,uchar *key, int forw);
+void SamOEMhash( uchar *data, const uchar *key, int val);
+void sam_pwd_hash(uint32 rid, const uchar *in, uchar *out, int forw);
+
+/*The following definitions come from libsmb/smbencrypt.c */
+
+void SMBencrypt(uchar * pwrd, uchar * c8, uchar * p24);
+void SMBNTencrypt(uchar * pwrd, uchar * c8, uchar * p24);
+void E_md4hash(uchar * pwrd, uchar * p16);
+void lm_owf_genW(const UNISTR2 * pwd, uchar p16[16]);
+void lm_owf_gen(const char *pwd, uchar p16[16]);
+void nt_owf_genW(const UNISTR2 * pwd, uchar nt_p16[16]);
+void nt_owf_gen(const char *pwd, uchar nt_p16[16]);
+void nt_lm_owf_genW(const UNISTR2 * pwd, uchar nt_p16[16], uchar lm_p16[16]);
+void nt_lm_owf_gen(const char *pwd, uchar nt_p16[16], uchar lm_p16[16]);
+void SMBOWFencrypt(const uchar pwrd[16], const uchar * c8, uchar p24[24]);
+void SMBOWFencrypt_ntv2(const uchar kr[16],
+ const uchar * srv_chal, int srv_chal_len,
+ const uchar * cli_chal, int cli_chal_len,
+ char resp_buf[16]);
+void SMBsesskeygen_ntv2(const uchar kr[16],
+ const uchar * nt_resp, char sess_key[16]);
+void SMBsesskeygen_ntv1(const uchar kr[16],
+ const uchar * nt_resp, char sess_key[16]);
+void SMBgenclientchals(char *lm_cli_chal,
+ char *nt_cli_chal, int *nt_cli_chal_len,
+ const char *srv, const char *dom);
+void ntv2_owf_gen(const uchar owf[16],
+ const char *user_n, const char *domain_n, uchar kr_buf[16]);
+void NTLMSSPOWFencrypt(const uchar pwrd[8], const uchar * ntlmchalresp,
+ uchar p24[24]);
+BOOL make_oem_passwd_hash(uchar data[516],
+ const char *pwrd, int new_pw_len,
+ const uchar old_pw_hash[16], BOOL unicode);
+BOOL nt_encrypt_string2(STRING2 * out, const STRING2 * in, const uchar * key);
+BOOL nt_decrypt_string2(STRING2 * out, const STRING2 * in, const uchar * key);
+void create_ntlmssp_resp(struct pwd_info *pwd,
+ char *domain, char *user_name, char *my_name,
+ uint32 ntlmssp_cli_flgs, prs_struct * auth_resp);
+BOOL decode_pw_buffer(const char buffer[516], char *new_pwrd,
+ int new_pwrd_size, uint32 * new_pw_len);
+BOOL encode_pw_buffer(char buffer[516], const char *new_pass,
+ int new_pw_len, BOOL nt_pass_set);
+
+/*The following definitions come from libsmb/smberr.c */
+
+char *smb_err_msg(uint8 class, uint32 num);
+BOOL smb_safe_err_msg(uint8 class, uint32 num, char *ret, size_t len);
+BOOL smb_safe_errstr(char *inbuf, char *msg, size_t len);
+char *smb_errstr(char *inbuf);
+
/*The following definitions come from locking/locking.c */
BOOL is_locked(files_struct *fsp,connection_struct *conn,
@@ -1154,18 +1154,12 @@ BOOL api_ntlsa_rpc(rpcsrv_struct *p);
/*The following definitions come from lsarpcd/srv_lsa_samdb.c */
-BOOL set_tdbsecname(struct policy_cache *cache, POLICY_HND *hnd,
- TDB_CONTEXT *tdb,
- const UNISTR2 *name);
-BOOL get_tdbsecname(struct policy_cache *cache, const POLICY_HND *hnd,
- TDB_CONTEXT **tdb,
- UNISTR2 *name);
uint32 _lsa_open_policy2(const UNISTR2 *server_name, POLICY_HND *hnd,
const LSA_OBJ_ATTR *attr,
uint32 des_access);
uint32 _lsa_open_policy(const UNISTR2 *server_name, POLICY_HND *hnd,
- const LSA_OBJ_ATTR *attr,
- uint32 des_access);
+ const LSA_OBJ_ATTR *attr,
+ uint32 des_access);
uint32 _lsa_enum_trust_dom(POLICY_HND *hnd, uint32 *enum_ctx,
uint32 *num_doms, UNISTR2 **uni_names,
DOM_SID ***sids);
@@ -1268,6 +1262,9 @@ BOOL queue_dns_query(struct packet_struct *p,struct nmb_name *question,
struct name_record **n);
void kill_async_dns_child(void);
+/*The following definitions come from nmbd/nmbd.c */
+
+
/*The following definitions come from nmbd/nmbd_become_dmb.c */
void add_domain_names(time_t t);
@@ -1298,9 +1295,6 @@ void announce_and_sync_with_domain_master_browser( struct subnet_record *subrec,
void collect_all_workgroup_names_from_wins_server(time_t t);
void sync_all_dmbs(time_t t);
-/*The following definitions come from nmbd/nmbd.c */
-
-
/*The following definitions come from nmbd/nmbd_elections.c */
void check_master_browser_exists(time_t t);
@@ -2060,6 +2054,11 @@ void init_devicemode(NT_DEVICEMODE *nt_devmode);
BOOL pcap_printername_ok(char *pszPrintername, char *pszPrintcapname);
void pcap_printer_fn(void (*fn)(char *, char *));
+/*The following definitions come from printing/print_svid.c */
+
+void sysv_printer_fn(void (*fn)(char *, char *));
+int sysv_printername_ok(char *name);
+
/*The following definitions come from printing/printing.c */
void lpq_reset(int snum);
@@ -2078,11 +2077,6 @@ uint32 status_printqueue(connection_struct *conn,const vuser_key *key,
int snum,int status);
void load_printers(void);
-/*The following definitions come from printing/print_svid.c */
-
-void sysv_printer_fn(void (*fn)(char *, char *));
-int sysv_printername_ok(char *name);
-
/*The following definitions come from profile/profile.c */
BOOL profile_setup(BOOL rdonly);
@@ -2168,7 +2162,7 @@ uint32 cli_nt_setup_creds(const char *srv_name,
const char *myhostname,
const char *trust_acct,
const uchar trust_pwd[16], uint16 sec_chan,
- uint16 *validation_level);
+ uint16 * validation_level);
BOOL cli_nt_srv_pwset(const char *srv_name, const char *myhostname,
const char *trust_acct,
const uchar * new_hashof_trust_pwd, uint16 sec_chan);
@@ -2553,306 +2547,6 @@ void cli_use_wait_keyboard(void);
BOOL wks_query_info( char *srv_name, uint32 switch_value,
WKS_INFO_100 *wks100);
-/*The following definitions come from rpcclient/cmdat.c */
-
-
-/*The following definitions come from rpcclient/cmdat_cmds.c */
-
-void add_at_commands(void);
-
-/*The following definitions come from rpcclient/cmd_atsvc.c */
-
-void cmd_at(struct client_info *info, int argc, char *argv[]);
-
-/*The following definitions come from rpcclient/cmd_brs.c */
-
-void cmd_brs_query_info(struct client_info *info, int argc, char *argv[]);
-
-/*The following definitions come from rpcclient/cmd_eventlog.c */
-
-void cmd_eventlog(struct client_info *info, int argc, char *argv[]);
-
-/*The following definitions come from rpcclient/cmd_lsarpc.c */
-
-void cmd_lsa_enum_trust_dom(struct client_info *info, int argc, char *argv[]);
-void cmd_lsa_query_info(struct client_info *info, int argc, char *argv[]);
-void cmd_lsa_lookup_names(struct client_info *info, int argc, char *argv[]);
-void cmd_lsa_lookup_sids(struct client_info *info, int argc, char *argv[]);
-void cmd_lsa_set_secret(struct client_info *info, int argc, char *argv[]);
-void cmd_lsa_create_secret(struct client_info *info, int argc, char *argv[]);
-void cmd_lsa_query_secret_secobj(struct client_info *info, int argc, char *argv[]);
-void cmd_lsa_query_secret(struct client_info *info, int argc, char *argv[]);
-
-/*The following definitions come from rpcclient/cmd_netlogon.c */
-
-void cmd_netlogon_login_test(struct client_info *info, int argc, char *argv[]);
-void cmd_netlogon_domain_test(struct client_info *info, int argc,
- char *argv[]);
-void cmd_sam_sync(struct client_info *info, int argc, char *argv[]);
-
-/*The following definitions come from rpcclient/cmd_reg.c */
-
-void split_server_keyname(char *srv_name, char *key, const char* arg);
-BOOL msrpc_reg_enum_key(const char* srv_name, const char* full_keyname,
- REG_FN(reg_fn),
- REG_KEY_FN(reg_key_fn),
- REG_VAL_FN(reg_val_fn));
-void cmd_reg_enum(struct client_info *info, int argc, char *argv[]);
-void cmd_reg_query_info(struct client_info *info, int argc, char *argv[]);
-void cmd_reg_query_key(struct client_info *info, int argc, char *argv[]);
-void cmd_reg_create_val(struct client_info *info, int argc, char *argv[]);
-void cmd_reg_delete_val(struct client_info *info, int argc, char *argv[]);
-void cmd_reg_delete_key(struct client_info *info, int argc, char *argv[]);
-void cmd_reg_create_key(struct client_info *info, int argc, char *argv[]);
-void cmd_reg_test_key_sec(struct client_info *info, int argc, char *argv[]);
-void cmd_reg_get_key_sec(struct client_info *info, int argc, char *argv[]);
-void cmd_reg_shutdown(struct client_info *info, int argc, char *argv[]);
-
-/*The following definitions come from rpcclient/cmd_samr.c */
-
-void cmd_sam_ntchange_pwd(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_test(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_lookup_domain(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_lookup_names(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_lookup_rids(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_del_aliasmem(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_delete_dom_alias(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_add_aliasmem(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_create_dom_trusting(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_create_dom_user(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_create_dom_alias(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_del_groupmem(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_delete_dom_user(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_delete_dom_group(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_add_groupmem(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_create_dom_group(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_enum_users(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_query_groupmem(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_query_group(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_query_sec_obj(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_query_user(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_set_userinfo2(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_set_userinfo(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_query_dispinfo(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_query_dominfo(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_query_aliasmem(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_query_alias(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_enum_aliases(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_enum_groups(struct client_info *info, int argc, char *argv[]);
-void cmd_sam_enum_domains(struct client_info *info, int argc, char *argv[]);
-
-/*The following definitions come from rpcclient/cmd_spoolss.c */
-
-BOOL msrpc_spoolss_enum_printers(char* srv_name, uint32 flags, uint32 level, PRINTER_INFO_CTR ctr);
-void cmd_spoolss_enum_printers(struct client_info *info, int argc, char *argv[]);
-void cmd_spoolss_open_printer_ex(struct client_info *info, int argc, char *argv[]);
-BOOL msrpc_spoolss_enum_jobs( const char* printer_name,
- const char* station, const char* user_name,
- uint32 level,
- void ***ctr, JOB_INFO_FN(fn));
-void cmd_spoolss_enum_jobs(struct client_info *info, int argc, char *argv[]);
-BOOL msrpc_spoolss_enum_printerdata( const char* printer_name, const char* station, const char* user_name );
-void cmd_spoolss_enum_printerdata(struct client_info *info, int argc, char *argv[]);
-
-/*The following definitions come from rpcclient/cmd_srvsvc.c */
-
-BOOL net_srv_get_info(struct client_info *info,
- uint32 info_level,
- SRV_INFO_CTR *ctr);
-void cmd_srv_query_info(struct client_info *info, int argc, char *argv[]);
-BOOL msrpc_srv_enum_tprt( const char* dest_srv,
- uint32 info_level,
- SRV_TPRT_INFO_CTR *ctr,
- TPRT_INFO_FN(tprt_fn));
-void cmd_srv_enum_tprt(struct client_info *info, int argc, char *argv[]);
-void cmd_srv_enum_conn(struct client_info *info, int argc, char *argv[]);
-void cmd_srv_enum_shares(struct client_info *info, int argc, char *argv[]);
-void cmd_srv_share_get_info(struct client_info *info, int argc, char *argv[]);
-void cmd_srv_enum_sess(struct client_info *info, int argc, char *argv[]);
-void cmd_srv_enum_files(struct client_info *info, int argc, char *argv[]);
-void cmd_time(struct client_info *info, int argc, char *argv[]);
-
-/*The following definitions come from rpcclient/cmd_svcctl.c */
-
-void svc_display_query_svc_cfg(const QUERY_SERVICE_CONFIG *cfg);
-BOOL svc_query_service( POLICY_HND *pol_scm,
- const char *svc_name,
- SVC_QUERY_FN(svc_query_fn));
-void cmd_svc_info(struct client_info *info, int argc, char *argv[]);
-BOOL msrpc_svc_enum(const char* srv_name,
- ENUM_SRVC_STATUS **svcs,
- uint32 *num_svcs,
- SVC_INFO_FN(info_fn),
- SVC_QUERY_FN(query_fn));
-void cmd_svc_enum(struct client_info *info, int argc, char *argv[]);
-void cmd_svc_stop(struct client_info *info, int argc, char *argv[]);
-void cmd_svc_start(struct client_info *info, int argc, char *argv[]);
-void cmd_svc_set(struct client_info *info, int argc, char *argv[]);
-
-/*The following definitions come from rpcclient/cmd_wkssvc.c */
-
-void cmd_wks_query_info(struct client_info *info, int argc, char *argv[]);
-
-/*The following definitions come from rpcclient/display_at.c */
-
-void display_at_enum_info(FILE *out_hnd, enum action_type action,
- uint32 num_jobs, const AT_ENUM_INFO *const jobs,
- char *const *const commands);
-void display_at_job_info(FILE *out_hnd, enum action_type action,
- AT_JOB_INFO *const job, fstring command);
-
-/*The following definitions come from rpcclient/display_event.c */
-
-void display_eventlog_eventrecord(FILE *out_hnd, enum action_type action, EVENTLOGRECORD *const ev);
-
-/*The following definitions come from rpcclient/display_reg.c */
-
-char *get_reg_val_type_str(uint32 type);
-void display_reg_value_info(FILE *out_hnd, enum action_type action,
- const char *val_name,
- uint32 val_type, const BUFFER2 *value);
-void display_reg_key_info(FILE *out_hnd, enum action_type action,
- const char *key_name, time_t key_mod_time);
-
-/*The following definitions come from rpcclient/display_sam.c */
-
-void display_alias_members(FILE *out_hnd, enum action_type action,
- uint32 num_mem, char *const *const sid_mem,
- uint32 *const type);
-void display_alias_rid_info(FILE *out_hnd, enum action_type action,
- DOM_SID *const sid,
- uint32 num_rids, uint32 *const rid);
-void display_group_members(FILE *out_hnd, enum action_type action,
- uint32 num_mem, char *const *const name, uint32 *const type);
-void display_group_info1(FILE *out_hnd, enum action_type action, GROUP_INFO1 *const info1);
-void display_group_info4(FILE *out_hnd, enum action_type action, GROUP_INFO4 *const info4);
-void display_group_info_ctr(FILE *out_hnd, enum action_type action,
- GROUP_INFO_CTR *const ctr);
-void display_group_rid_info(FILE *out_hnd, enum action_type action,
- uint32 num_gids, DOM_GID *const gid);
-void display_alias_name_info(FILE *out_hnd, enum action_type action,
- uint32 num_aliases, fstring *const alias_name, const uint32 *const num_als_usrs);
-void display_alias_info3(FILE *out_hnd, enum action_type action, ALIAS_INFO3 *const info3);
-void display_alias_info_ctr(FILE *out_hnd, enum action_type action,
- ALIAS_INFO_CTR *const ctr);
-void display_sam_user_info_21(FILE *out_hnd, enum action_type action, SAM_USER_INFO_21 *const usr);
-void display_sam_unk_info_2(FILE *out_hnd, enum action_type action,
- SAM_UNK_INFO_2 *const info2);
-void display_sam_unk_ctr(FILE *out_hnd, enum action_type action,
- uint32 switch_value, SAM_UNK_CTR *const ctr);
-void display_sam_info_1(FILE *out_hnd, enum action_type action,
- SAM_ENTRY1 *const e1, SAM_STR1 *const s1);
-void display_sam_info_1_ctr(FILE *out_hnd, enum action_type action,
- uint32 count, SAM_DISPINFO_1 *const ctr);
-void display_sam_disp_info_ctr(FILE *out_hnd, enum action_type action,
- uint16 level, uint32 count,
- SAM_DISPINFO_CTR *const ctr);
-
-/*The following definitions come from rpcclient/display_sec.c */
-
-void display_sec_desc(FILE *out_hnd, enum action_type action, SEC_DESC *const sec);
-
-/*The following definitions come from rpcclient/display_spool.c */
-
-void display_printer_info_ctr(FILE *out_hnd, enum action_type action, uint32 level,
- uint32 count, PRINTER_INFO_CTR ctr);
-void display_printer_enumdata(FILE *out_hnd, enum action_type action, uint32 idx,
- uint32 valuelen, uint16 *value, uint32 rvaluelen,
- uint32 type,
- uint32 datalen, uint8 *data, uint32 rdatalen);
-void display_job_info_2(FILE *out_hnd, enum action_type action,
- JOB_INFO_2 *const i2);
-void display_job_info_1(FILE *out_hnd, enum action_type action,
- JOB_INFO_1 *const i1);
-void display_job_info_2_ctr(FILE *out_hnd, enum action_type action,
- uint32 count, JOB_INFO_2 *const *const ctr);
-void display_job_info_1_ctr(FILE *out_hnd, enum action_type action,
- uint32 count, JOB_INFO_1 *const *const ctr);
-void display_job_info_ctr(FILE *out_hnd, enum action_type action,
- uint32 level, uint32 count,
- void *const *const ctr);
-
-/*The following definitions come from rpcclient/display_srv.c */
-
-char *get_file_mode_str(uint32 share_mode);
-char *get_file_oplock_str(uint32 op_type);
-char *get_server_type_str(uint32 type);
-void display_srv_info_ctr(FILE *out_hnd, enum action_type action,
- const SRV_INFO_CTR *ctr);
-void display_conn_info_0(FILE *out_hnd, enum action_type action,
- CONN_INFO_0 *const info0);
-void display_conn_info_1(FILE *out_hnd, enum action_type action,
- CONN_INFO_1 *const info1, CONN_INFO_1_STR *const str1);
-void display_srv_conn_info_0_ctr(FILE *out_hnd, enum action_type action,
- SRV_CONN_INFO_0 *const ctr);
-void display_srv_conn_info_1_ctr(FILE *out_hnd, enum action_type action,
- SRV_CONN_INFO_1 *const ctr);
-void display_srv_conn_info_ctr(FILE *out_hnd, enum action_type action,
- SRV_CONN_INFO_CTR *const ctr);
-void display_tprt_info_0(FILE *out_hnd, enum action_type action,
- TPRT_INFO_0 *const info0, TPRT_INFO_0_STR *const str0);
-void display_srv_tprt_info_0_ctr(FILE *out_hnd, enum action_type action,
- const SRV_TPRT_INFO_0 *const ctr);
-void display_srv_tprt_info_ctr(FILE *out_hnd, enum action_type action,
- const SRV_TPRT_INFO_CTR *const ctr);
-void display_srv_share_info_ctr(FILE *out_hnd, enum action_type action,
- SRV_SHARE_INFO_CTR *const ctr);
-void display_srv_file_info_ctr(FILE *out_hnd, enum action_type action,
- SRV_FILE_INFO_CTR *const ctr);
-void display_sess_info_0(FILE *out_hnd, enum action_type action,
- SESS_INFO_0 *const info0, SESS_INFO_0_STR *const str0);
-void display_sess_info_1(FILE *out_hnd, enum action_type action,
- SESS_INFO_1 *const info1, SESS_INFO_1_STR *const str1);
-void display_srv_sess_info_0_ctr(FILE *out_hnd, enum action_type action,
- SRV_SESS_INFO_0 *const ctr);
-void display_srv_sess_info_1_ctr(FILE *out_hnd, enum action_type action,
- SRV_SESS_INFO_1 *const ctr);
-void display_srv_sess_info_ctr(FILE *out_hnd, enum action_type action,
- SRV_SESS_INFO_CTR *const ctr);
-void display_server(FILE *out_hnd, enum action_type action,
- char *const sname, uint32 type, char *const comment);
-void display_share(FILE *out_hnd, enum action_type action,
- char *const sname, uint32 type, char *const comment);
-void display_share2(FILE *out_hnd, enum action_type action,
- char *const sname, uint32 type, char *const comment,
- uint32 perms, uint32 max_uses, uint32 num_uses,
- char *const path, char *const password);
-void display_name(FILE *out_hnd, enum action_type action,
- char *const sname);
-
-/*The following definitions come from rpcclient/display_svc.c */
-
-char *get_svc_start_type_str(uint32 type);
-void display_query_svc_cfg(FILE *out_hnd, enum action_type action,
- const QUERY_SERVICE_CONFIG *const cfg);
-void display_svc_info(FILE *out_hnd, enum action_type action,
- const ENUM_SRVC_STATUS *const svc);
-
-/*The following definitions come from rpcclient/display_sync.c */
-
-void display_sam_sync_ctr(FILE *out_hnd, enum action_type action,
- SAM_DELTA_HDR *const delta,
- SAM_DELTA_CTR *const ctr);
-void display_sam_sync(FILE *out_hnd, enum action_type action,
- SAM_DELTA_HDR *const deltas,
- SAM_DELTA_CTR *const ctr,
- uint32 num);
-
-/*The following definitions come from rpcclient/eventlog.c */
-
-int main(int argc, char *argv[]);
-
-/*The following definitions come from rpcclient/eventlog_cmds.c */
-
-void add_evt_commands(void);
-
-/*The following definitions come from rpcclient/lsa.c */
-
-
-/*The following definitions come from rpcclient/lsa_cmds.c */
-
-void add_lsa_commands(void);
-
/*The following definitions come from rpc_client/msrpc_lsarpc.c */
uint32 lookup_lsa_names(const char *srv_name,
@@ -3108,51 +2802,6 @@ BOOL ncalrpc_l_use_del(const char *pipe_name,
void ncalrpc_l_use_enum(uint32 * num_cons, struct use_info ***use);
void ncalrpc_use_wait_keyboard(void);
-/*The following definitions come from rpcclient/net.c */
-
-
-/*The following definitions come from rpcclient/net_cmds.c */
-
-void add_net_commands(void);
-
-/*The following definitions come from rpcclient/netlogon_cmds.c */
-
-void add_ntl_commands(void);
-
-/*The following definitions come from rpcclient/regedit.c */
-
-
-/*The following definitions come from rpcclient/regedit_cmds.c */
-
-void add_reg_commands(void);
-
-/*The following definitions come from rpcclient/rpcclient.c */
-
-
-/*The following definitions come from rpcclient/samedit.c */
-
-
-/*The following definitions come from rpcclient/samedit_cmds.c */
-
-void add_sam_commands(void);
-
-/*The following definitions come from rpcclient/spoolss.c */
-
-int main(int argc, char *argv[]);
-
-/*The following definitions come from rpcclient/spoolss_cmds.c */
-
-void add_spl_commands(void);
-
-/*The following definitions come from rpcclient/svcctrl.c */
-
-int main(int argc, char *argv[]);
-
-/*The following definitions come from rpcclient/svcctrl_cmds.c */
-
-char *complete_svcenum(char *text, int state);
-void add_svc_commands(void);
-
/*The following definitions come from rpc_parse/parse_creds.c */
BOOL make_creds_unix(CREDS_UNIX *r_u, const char* user_name,
@@ -3759,14 +3408,359 @@ BOOL api_svcctl_rpc(rpcsrv_struct *p);
BOOL api_wkssvc_rpc(rpcsrv_struct *p);
-/*The following definitions come from samrd/samrd.c */
+/*The following definitions come from rpcclient/cmd_atsvc.c */
-msrpc_service_fns *get_service_fns(void);
+void cmd_at(struct client_info *info, int argc, char *argv[]);
+
+/*The following definitions come from rpcclient/cmd_brs.c */
+
+void cmd_brs_query_info(struct client_info *info, int argc, char *argv[]);
+
+/*The following definitions come from rpcclient/cmd_eventlog.c */
+
+void cmd_eventlog(struct client_info *info, int argc, char *argv[]);
+
+/*The following definitions come from rpcclient/cmd_lsarpc.c */
+
+void cmd_lsa_enum_trust_dom(struct client_info *info, int argc, char *argv[]);
+void cmd_lsa_query_info(struct client_info *info, int argc, char *argv[]);
+void cmd_lsa_lookup_names(struct client_info *info, int argc, char *argv[]);
+void cmd_lsa_lookup_sids(struct client_info *info, int argc, char *argv[]);
+void cmd_lsa_set_secret(struct client_info *info, int argc, char *argv[]);
+void cmd_lsa_create_secret(struct client_info *info, int argc, char *argv[]);
+void cmd_lsa_query_secret_secobj(struct client_info *info, int argc, char *argv[]);
+void cmd_lsa_query_secret(struct client_info *info, int argc, char *argv[]);
+
+/*The following definitions come from rpcclient/cmd_netlogon.c */
+
+void cmd_netlogon_login_test(struct client_info *info, int argc, char *argv[]);
+void cmd_netlogon_domain_test(struct client_info *info, int argc,
+ char *argv[]);
+void cmd_sam_sync(struct client_info *info, int argc, char *argv[]);
+
+/*The following definitions come from rpcclient/cmd_reg.c */
+
+void split_server_keyname(char *srv_name, char *key, const char* arg);
+BOOL msrpc_reg_enum_key(const char* srv_name, const char* full_keyname,
+ REG_FN(reg_fn),
+ REG_KEY_FN(reg_key_fn),
+ REG_VAL_FN(reg_val_fn));
+void cmd_reg_enum(struct client_info *info, int argc, char *argv[]);
+void cmd_reg_query_info(struct client_info *info, int argc, char *argv[]);
+void cmd_reg_query_key(struct client_info *info, int argc, char *argv[]);
+void cmd_reg_create_val(struct client_info *info, int argc, char *argv[]);
+void cmd_reg_delete_val(struct client_info *info, int argc, char *argv[]);
+void cmd_reg_delete_key(struct client_info *info, int argc, char *argv[]);
+void cmd_reg_create_key(struct client_info *info, int argc, char *argv[]);
+void cmd_reg_test_key_sec(struct client_info *info, int argc, char *argv[]);
+void cmd_reg_get_key_sec(struct client_info *info, int argc, char *argv[]);
+void cmd_reg_shutdown(struct client_info *info, int argc, char *argv[]);
+
+/*The following definitions come from rpcclient/cmd_samr.c */
+
+void cmd_sam_ntchange_pwd(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_test(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_lookup_domain(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_lookup_names(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_lookup_rids(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_del_aliasmem(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_delete_dom_alias(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_add_aliasmem(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_create_dom_trusting(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_create_dom_user(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_create_dom_alias(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_del_groupmem(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_delete_dom_user(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_delete_dom_group(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_add_groupmem(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_create_dom_group(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_enum_users(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_query_groupmem(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_query_group(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_query_sec_obj(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_query_user(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_set_userinfo2(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_set_userinfo(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_query_dispinfo(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_query_dominfo(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_query_aliasmem(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_query_alias(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_enum_aliases(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_enum_groups(struct client_info *info, int argc, char *argv[]);
+void cmd_sam_enum_domains(struct client_info *info, int argc, char *argv[]);
+
+/*The following definitions come from rpcclient/cmd_spoolss.c */
+
+BOOL msrpc_spoolss_enum_printers(char* srv_name, uint32 flags, uint32 level, PRINTER_INFO_CTR ctr);
+void cmd_spoolss_enum_printers(struct client_info *info, int argc, char *argv[]);
+void cmd_spoolss_open_printer_ex(struct client_info *info, int argc, char *argv[]);
+BOOL msrpc_spoolss_enum_jobs( const char* printer_name,
+ const char* station, const char* user_name,
+ uint32 level,
+ void ***ctr, JOB_INFO_FN(fn));
+void cmd_spoolss_enum_jobs(struct client_info *info, int argc, char *argv[]);
+BOOL msrpc_spoolss_enum_printerdata( const char* printer_name, const char* station, const char* user_name );
+void cmd_spoolss_enum_printerdata(struct client_info *info, int argc, char *argv[]);
+
+/*The following definitions come from rpcclient/cmd_srvsvc.c */
+
+BOOL net_srv_get_info(struct client_info *info,
+ uint32 info_level,
+ SRV_INFO_CTR *ctr);
+void cmd_srv_query_info(struct client_info *info, int argc, char *argv[]);
+BOOL msrpc_srv_enum_tprt( const char* dest_srv,
+ uint32 info_level,
+ SRV_TPRT_INFO_CTR *ctr,
+ TPRT_INFO_FN(tprt_fn));
+void cmd_srv_enum_tprt(struct client_info *info, int argc, char *argv[]);
+void cmd_srv_enum_conn(struct client_info *info, int argc, char *argv[]);
+void cmd_srv_enum_shares(struct client_info *info, int argc, char *argv[]);
+void cmd_srv_share_get_info(struct client_info *info, int argc, char *argv[]);
+void cmd_srv_enum_sess(struct client_info *info, int argc, char *argv[]);
+void cmd_srv_enum_files(struct client_info *info, int argc, char *argv[]);
+void cmd_time(struct client_info *info, int argc, char *argv[]);
+
+/*The following definitions come from rpcclient/cmd_svcctl.c */
+
+void svc_display_query_svc_cfg(const QUERY_SERVICE_CONFIG *cfg);
+BOOL svc_query_service( POLICY_HND *pol_scm,
+ const char *svc_name,
+ SVC_QUERY_FN(svc_query_fn));
+void cmd_svc_info(struct client_info *info, int argc, char *argv[]);
+BOOL msrpc_svc_enum(const char* srv_name,
+ ENUM_SRVC_STATUS **svcs,
+ uint32 *num_svcs,
+ SVC_INFO_FN(info_fn),
+ SVC_QUERY_FN(query_fn));
+void cmd_svc_enum(struct client_info *info, int argc, char *argv[]);
+void cmd_svc_stop(struct client_info *info, int argc, char *argv[]);
+void cmd_svc_start(struct client_info *info, int argc, char *argv[]);
+void cmd_svc_set(struct client_info *info, int argc, char *argv[]);
+
+/*The following definitions come from rpcclient/cmd_wkssvc.c */
+
+void cmd_wks_query_info(struct client_info *info, int argc, char *argv[]);
+
+/*The following definitions come from rpcclient/cmdat.c */
+
+
+/*The following definitions come from rpcclient/cmdat_cmds.c */
+
+void add_at_commands(void);
+
+/*The following definitions come from rpcclient/display_at.c */
+
+void display_at_enum_info(FILE *out_hnd, enum action_type action,
+ uint32 num_jobs, const AT_ENUM_INFO *const jobs,
+ char *const *const commands);
+void display_at_job_info(FILE *out_hnd, enum action_type action,
+ AT_JOB_INFO *const job, fstring command);
+
+/*The following definitions come from rpcclient/display_event.c */
+
+void display_eventlog_eventrecord(FILE *out_hnd, enum action_type action, EVENTLOGRECORD *const ev);
+
+/*The following definitions come from rpcclient/display_reg.c */
+
+char *get_reg_val_type_str(uint32 type);
+void display_reg_value_info(FILE *out_hnd, enum action_type action,
+ const char *val_name,
+ uint32 val_type, const BUFFER2 *value);
+void display_reg_key_info(FILE *out_hnd, enum action_type action,
+ const char *key_name, time_t key_mod_time);
+
+/*The following definitions come from rpcclient/display_sam.c */
+
+void display_alias_members(FILE *out_hnd, enum action_type action,
+ uint32 num_mem, char *const *const sid_mem,
+ uint32 *const type);
+void display_alias_rid_info(FILE *out_hnd, enum action_type action,
+ DOM_SID *const sid,
+ uint32 num_rids, uint32 *const rid);
+void display_group_members(FILE *out_hnd, enum action_type action,
+ uint32 num_mem, char *const *const name, uint32 *const type);
+void display_group_info1(FILE *out_hnd, enum action_type action, GROUP_INFO1 *const info1);
+void display_group_info4(FILE *out_hnd, enum action_type action, GROUP_INFO4 *const info4);
+void display_group_info_ctr(FILE *out_hnd, enum action_type action,
+ GROUP_INFO_CTR *const ctr);
+void display_group_rid_info(FILE *out_hnd, enum action_type action,
+ uint32 num_gids, DOM_GID *const gid);
+void display_alias_name_info(FILE *out_hnd, enum action_type action,
+ uint32 num_aliases, fstring *const alias_name, const uint32 *const num_als_usrs);
+void display_alias_info3(FILE *out_hnd, enum action_type action, ALIAS_INFO3 *const info3);
+void display_alias_info_ctr(FILE *out_hnd, enum action_type action,
+ ALIAS_INFO_CTR *const ctr);
+void display_sam_user_info_21(FILE *out_hnd, enum action_type action, SAM_USER_INFO_21 *const usr);
+void display_sam_unk_info_2(FILE *out_hnd, enum action_type action,
+ SAM_UNK_INFO_2 *const info2);
+void display_sam_unk_ctr(FILE *out_hnd, enum action_type action,
+ uint32 switch_value, SAM_UNK_CTR *const ctr);
+void display_sam_info_1(FILE *out_hnd, enum action_type action,
+ SAM_ENTRY1 *const e1, SAM_STR1 *const s1);
+void display_sam_info_1_ctr(FILE *out_hnd, enum action_type action,
+ uint32 count, SAM_DISPINFO_1 *const ctr);
+void display_sam_disp_info_ctr(FILE *out_hnd, enum action_type action,
+ uint16 level, uint32 count,
+ SAM_DISPINFO_CTR *const ctr);
+
+/*The following definitions come from rpcclient/display_sec.c */
+
+void display_sec_desc(FILE *out_hnd, enum action_type action, SEC_DESC *const sec);
+
+/*The following definitions come from rpcclient/display_spool.c */
+
+void display_printer_info_ctr(FILE *out_hnd, enum action_type action, uint32 level,
+ uint32 count, PRINTER_INFO_CTR ctr);
+void display_printer_enumdata(FILE *out_hnd, enum action_type action, uint32 idx,
+ uint32 valuelen, uint16 *value, uint32 rvaluelen,
+ uint32 type,
+ uint32 datalen, uint8 *data, uint32 rdatalen);
+void display_job_info_2(FILE *out_hnd, enum action_type action,
+ JOB_INFO_2 *const i2);
+void display_job_info_1(FILE *out_hnd, enum action_type action,
+ JOB_INFO_1 *const i1);
+void display_job_info_2_ctr(FILE *out_hnd, enum action_type action,
+ uint32 count, JOB_INFO_2 *const *const ctr);
+void display_job_info_1_ctr(FILE *out_hnd, enum action_type action,
+ uint32 count, JOB_INFO_1 *const *const ctr);
+void display_job_info_ctr(FILE *out_hnd, enum action_type action,
+ uint32 level, uint32 count,
+ void *const *const ctr);
+
+/*The following definitions come from rpcclient/display_srv.c */
+
+char *get_file_mode_str(uint32 share_mode);
+char *get_file_oplock_str(uint32 op_type);
+char *get_server_type_str(uint32 type);
+void display_srv_info_ctr(FILE *out_hnd, enum action_type action,
+ const SRV_INFO_CTR *ctr);
+void display_conn_info_0(FILE *out_hnd, enum action_type action,
+ CONN_INFO_0 *const info0);
+void display_conn_info_1(FILE *out_hnd, enum action_type action,
+ CONN_INFO_1 *const info1, CONN_INFO_1_STR *const str1);
+void display_srv_conn_info_0_ctr(FILE *out_hnd, enum action_type action,
+ SRV_CONN_INFO_0 *const ctr);
+void display_srv_conn_info_1_ctr(FILE *out_hnd, enum action_type action,
+ SRV_CONN_INFO_1 *const ctr);
+void display_srv_conn_info_ctr(FILE *out_hnd, enum action_type action,
+ SRV_CONN_INFO_CTR *const ctr);
+void display_tprt_info_0(FILE *out_hnd, enum action_type action,
+ TPRT_INFO_0 *const info0, TPRT_INFO_0_STR *const str0);
+void display_srv_tprt_info_0_ctr(FILE *out_hnd, enum action_type action,
+ const SRV_TPRT_INFO_0 *const ctr);
+void display_srv_tprt_info_ctr(FILE *out_hnd, enum action_type action,
+ const SRV_TPRT_INFO_CTR *const ctr);
+void display_srv_share_info_ctr(FILE *out_hnd, enum action_type action,
+ SRV_SHARE_INFO_CTR *const ctr);
+void display_srv_file_info_ctr(FILE *out_hnd, enum action_type action,
+ SRV_FILE_INFO_CTR *const ctr);
+void display_sess_info_0(FILE *out_hnd, enum action_type action,
+ SESS_INFO_0 *const info0, SESS_INFO_0_STR *const str0);
+void display_sess_info_1(FILE *out_hnd, enum action_type action,
+ SESS_INFO_1 *const info1, SESS_INFO_1_STR *const str1);
+void display_srv_sess_info_0_ctr(FILE *out_hnd, enum action_type action,
+ SRV_SESS_INFO_0 *const ctr);
+void display_srv_sess_info_1_ctr(FILE *out_hnd, enum action_type action,
+ SRV_SESS_INFO_1 *const ctr);
+void display_srv_sess_info_ctr(FILE *out_hnd, enum action_type action,
+ SRV_SESS_INFO_CTR *const ctr);
+void display_server(FILE *out_hnd, enum action_type action,
+ char *const sname, uint32 type, char *const comment);
+void display_share(FILE *out_hnd, enum action_type action,
+ char *const sname, uint32 type, char *const comment);
+void display_share2(FILE *out_hnd, enum action_type action,
+ char *const sname, uint32 type, char *const comment,
+ uint32 perms, uint32 max_uses, uint32 num_uses,
+ char *const path, char *const password);
+void display_name(FILE *out_hnd, enum action_type action,
+ char *const sname);
+
+/*The following definitions come from rpcclient/display_svc.c */
+
+char *get_svc_start_type_str(uint32 type);
+void display_query_svc_cfg(FILE *out_hnd, enum action_type action,
+ const QUERY_SERVICE_CONFIG *const cfg);
+void display_svc_info(FILE *out_hnd, enum action_type action,
+ const ENUM_SRVC_STATUS *const svc);
+
+/*The following definitions come from rpcclient/display_sync.c */
+
+void display_sam_sync_ctr(FILE *out_hnd, enum action_type action,
+ SAM_DELTA_HDR *const delta,
+ SAM_DELTA_CTR *const ctr);
+void display_sam_sync(FILE *out_hnd, enum action_type action,
+ SAM_DELTA_HDR *const deltas,
+ SAM_DELTA_CTR *const ctr,
+ uint32 num);
+
+/*The following definitions come from rpcclient/eventlog.c */
+
+int main(int argc, char *argv[]);
+
+/*The following definitions come from rpcclient/eventlog_cmds.c */
+
+void add_evt_commands(void);
+
+/*The following definitions come from rpcclient/lsa.c */
+
+
+/*The following definitions come from rpcclient/lsa_cmds.c */
+
+void add_lsa_commands(void);
+
+/*The following definitions come from rpcclient/net.c */
+
+
+/*The following definitions come from rpcclient/net_cmds.c */
+
+void add_net_commands(void);
+
+/*The following definitions come from rpcclient/netlogon_cmds.c */
+
+void add_ntl_commands(void);
+
+/*The following definitions come from rpcclient/regedit.c */
+
+
+/*The following definitions come from rpcclient/regedit_cmds.c */
+
+void add_reg_commands(void);
+
+/*The following definitions come from rpcclient/rpcclient.c */
+
+
+/*The following definitions come from rpcclient/samedit.c */
+
+
+/*The following definitions come from rpcclient/samedit_cmds.c */
+
+void add_sam_commands(void);
+
+/*The following definitions come from rpcclient/spoolss.c */
+
+int main(int argc, char *argv[]);
+
+/*The following definitions come from rpcclient/spoolss_cmds.c */
+
+void add_spl_commands(void);
+
+/*The following definitions come from rpcclient/svcctrl.c */
+
+int main(int argc, char *argv[]);
+
+/*The following definitions come from rpcclient/svcctrl_cmds.c */
+
+char *complete_svcenum(char *text, int state);
+void add_svc_commands(void);
/*The following definitions come from samrd/samr_util.c */
uint32 samr_make_usr_obj_sd(SEC_DESC_BUF *buf, DOM_SID *usr_sid);
+/*The following definitions come from samrd/samrd.c */
+
+msrpc_service_fns *get_service_fns(void);
+
/*The following definitions come from samrd/srv_samr_als_tdb.c */
uint32 _samr_add_aliasmem(const POLICY_HND *alias_pol, const DOM_SID *sid);
@@ -4588,17 +4582,6 @@ BOOL become_user(connection_struct *conn, uint16 vuid);
BOOL become_userk(connection_struct *conn, const vuser_key *key);
BOOL unbecome_user(void );
-/*The following definitions come from smbd/vfs.c */
-
-int vfs_init_default(connection_struct *conn);
-BOOL vfs_init_custom(connection_struct *conn);
-BOOL vfs_file_exist(connection_struct *conn,char *fname,SMB_STRUCT_STAT *sbuf);
-ssize_t vfs_write_data(files_struct *fsp,char *buffer,size_t N);
-SMB_OFF_T vfs_transfer_file(int in_fd, files_struct *in_fsp,
- int out_fd, files_struct *out_fsp,
- SMB_OFF_T n, char *header, int headlen, int align);
-char *vfs_readdirname(connection_struct *conn, void *p);
-
/*The following definitions come from smbd/vfs-wrap.c */
int vfswrap_dummy_connect(struct vfs_connection_struct *conn, char *service,
@@ -4628,6 +4611,17 @@ int vfswrap_unlink(char *path);
int vfswrap_chmod(char *path, mode_t mode);
int vfswrap_utime(char *path, struct utimbuf *times);
+/*The following definitions come from smbd/vfs.c */
+
+int vfs_init_default(connection_struct *conn);
+BOOL vfs_init_custom(connection_struct *conn);
+BOOL vfs_file_exist(connection_struct *conn,char *fname,SMB_STRUCT_STAT *sbuf);
+ssize_t vfs_write_data(files_struct *fsp,char *buffer,size_t N);
+SMB_OFF_T vfs_transfer_file(int in_fd, files_struct *in_fsp,
+ int out_fd, files_struct *out_fsp,
+ SMB_OFF_T n, char *header, int headlen, int align);
+char *vfs_readdirname(connection_struct *conn, void *p);
+
/*The following definitions come from smbwrapper/realcalls.c */
int real_utime(const char *name, struct utimbuf *buf);
diff --git a/source/include/rpc_client_proto.h b/source/include/rpc_client_proto.h
index 897265ffad6..8499651e452 100644
--- a/source/include/rpc_client_proto.h
+++ b/source/include/rpc_client_proto.h
@@ -84,7 +84,7 @@ uint32 cli_nt_setup_creds(const char *srv_name,
const char *myhostname,
const char *trust_acct,
const uchar trust_pwd[16], uint16 sec_chan,
- uint16 *validation_level);
+ uint16 * validation_level);
BOOL cli_nt_srv_pwset(const char *srv_name, const char *myhostname,
const char *trust_acct,
const uchar * new_hashof_trust_pwd, uint16 sec_chan);
diff --git a/source/include/rpc_parse_proto.h b/source/include/rpc_parse_proto.h
index b5fc732a9c1..6ae4d6c32af 100644
--- a/source/include/rpc_parse_proto.h
+++ b/source/include/rpc_parse_proto.h
@@ -497,8 +497,6 @@ BOOL samr_io_group_info1(char *desc, GROUP_INFO1 * gr1, prs_struct * ps,
BOOL make_samr_group_info4(GROUP_INFO4 * gr4, const char *acct_desc);
BOOL samr_io_group_info4(char *desc, GROUP_INFO4 * gr4, prs_struct * ps,
int depth);
-BOOL samr_group_info_ctr(char *desc, GROUP_INFO_CTR * ctr, prs_struct * ps,
- int depth);
BOOL make_samr_q_create_dom_group(SAMR_Q_CREATE_DOM_GROUP * q_e,
POLICY_HND * pol, const char *acct_desc);
BOOL samr_io_q_create_dom_group(char *desc, SAMR_Q_CREATE_DOM_GROUP * q_e,
diff --git a/source/include/winbindd_proto.h b/source/include/winbindd_proto.h
index 881b69097ac..dd869408cc5 100644
--- a/source/include/winbindd_proto.h
+++ b/source/include/winbindd_proto.h
@@ -185,263 +185,10 @@ void CatchChildLeaveStatus(void);
int vslprintf(char *str, int n, char *format, va_list ap);
-/*The following definitions come from libsmb/clientgen.c */
-
-int cli_set_port(struct cli_state *cli, int port);
-char *cli_errstr(struct cli_state *cli);
-void cli_safe_smb_errstr(struct cli_state *cli, char *msg, size_t len);
-BOOL get_safe_rap_errstr(int rap_error, char *err_msg, size_t msglen);
-void cli_safe_errstr(struct cli_state *cli, char *err_msg, size_t msglen);
-BOOL cli_send_trans(struct cli_state *cli, int trans,
- char *name, int pipe_name_len,
- int fid, int flags,
- uint16 *setup, int lsetup, int msetup,
- char *param, int lparam, int mparam,
- char *data, int ldata, int mdata);
-BOOL cli_api_pipe(struct cli_state *cli, char *pipe_name, int pipe_name_len,
- uint16 *setup, uint32 setup_count, uint32 max_setup_count,
- char *params, uint32 param_count, uint32 max_param_count,
- char *data, uint32 data_count, uint32 max_data_count,
- char **rparam, uint32 *rparam_count,
- char **rdata, uint32 *rdata_count);
-BOOL cli_api(struct cli_state *cli,
- char *param, int prcnt, int mprcnt,
- char *data, int drcnt, int mdrcnt,
- char **rparam, int *rprcnt,
- char **rdata, int *rdrcnt);
-BOOL cli_NetWkstaUserLogon(struct cli_state *cli,char *user, char *workstation);
-BOOL cli_RNetShareEnum(struct cli_state *cli, void (*fn)(const char *, uint32, const char *));
-BOOL cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype,
- void (*fn)(const char *, uint32, const char *));
-BOOL cli_session_setup_x(struct cli_state *cli,
- char *user,
- char *pass, int passlen,
- char *ntpass, int ntpasslen,
- char *user_domain);
-BOOL cli_session_setup(struct cli_state *cli,
- char *myhostname, char *user,
- char *pass, int passlen,
- char *ntpass, int ntpasslen,
- char *user_domain);
-BOOL cli_ulogoff(struct cli_state *cli);
-BOOL cli_send_tconX(struct cli_state *cli,
- char *share, char *dev, char *pass, int passlen);
-BOOL cli_tdis(struct cli_state *cli);
-BOOL cli_rename(struct cli_state *cli, char *fname_src, char *fname_dst);
-BOOL cli_unlink(struct cli_state *cli, char *fname);
-BOOL cli_mkdir(struct cli_state *cli, char *dname);
-BOOL cli_rmdir(struct cli_state *cli, char *dname);
-int cli_nt_create(struct cli_state *cli, const char *fname);
-int cli_open(struct cli_state *cli, const char *fname,
- int flags, int share_mode);
-BOOL cli_close(struct cli_state *cli, int fnum);
-BOOL cli_lock(struct cli_state *cli, int fnum, uint32 offset, uint32 len, int timeout);
-BOOL cli_unlock(struct cli_state *cli, int fnum, uint32 offset, uint32 len, int timeout);
-size_t cli_read_one(struct cli_state *cli, int fnum, char *buf, off_t offset, size_t size);
-size_t cli_read(struct cli_state *cli, int fnum, char *buf, off_t offset, size_t size, BOOL overlap);
-ssize_t cli_write(struct cli_state *cli,
- int fnum, uint16 write_mode,
- char *buf, off_t offset, size_t size, size_t bytes_left);
-BOOL cli_getattrE(struct cli_state *cli, int fd,
- uint16 *attr, size_t *size,
- time_t *c_time, time_t *a_time, time_t *m_time);
-BOOL cli_getatr(struct cli_state *cli, char *fname,
- uint16 *attr, size_t *size, time_t *t);
-BOOL cli_setatr(struct cli_state *cli, char *fname, uint16 attr, time_t t);
-BOOL cli_qpathinfo(struct cli_state *cli, const char *fname,
- time_t *c_time, time_t *a_time, time_t *m_time,
- size_t *size, uint16 *mode);
-BOOL cli_qpathinfo2(struct cli_state *cli, const char *fname,
- time_t *c_time, time_t *a_time, time_t *m_time,
- time_t *w_time, size_t *size, uint16 *mode,
- SMB_INO_T *ino);
-BOOL cli_qfileinfo(struct cli_state *cli, int fnum,
- uint16 *mode, size_t *size,
- time_t *c_time, time_t *a_time, time_t *m_time,
- time_t *w_time, SMB_INO_T *ino);
-int cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
- void (*fn)(file_info *, const char *));
-BOOL cli_oem_change_password(struct cli_state *cli, const char *user, const char *new_password,
- const char *old_password);
-BOOL cli_negprot(struct cli_state *cli);
-BOOL cli_session_request(struct cli_state *cli,
- struct nmb_name *calling, struct nmb_name *called);
-BOOL cli_connect(struct cli_state *cli, const char *host, struct in_addr *ip);
-void cli_init_creds(struct cli_state *cli, const struct ntuser_creds *usr);
-struct cli_state *cli_initialise(struct cli_state *cli);
-void cli_close_socket(struct cli_state *cli);
-void cli_shutdown(struct cli_state *cli);
-int cli_error(struct cli_state *cli, uint8 *eclass, uint32 *num);
-void cli_sockopt(struct cli_state *cli, char *options);
-uint16 cli_setpid(struct cli_state *cli, uint16 pid);
-BOOL cli_reestablish_connection(struct cli_state *cli);
-BOOL cli_establish_connection(struct cli_state *cli,
- const char *dest_host, struct in_addr *dest_ip,
- struct nmb_name *calling, struct nmb_name *called,
- char *service, char *service_type,
- BOOL do_shutdown, BOOL do_tcon);
-BOOL cli_connect_auth(struct cli_state *cli,
- const char* desthost,
- struct in_addr *dest_ip,
- const struct ntuser_creds *usr);
-BOOL cli_connect_servers_auth(struct cli_state *cli,
- char *p,
- const struct ntuser_creds *usr);
-BOOL cli_connect_serverlist(struct cli_state *cli, char *p);
-int cli_printjob_del(struct cli_state *cli, int job);
-int cli_print_queue(struct cli_state *cli,
- void (*fn)(struct print_job_info *));
-BOOL cli_chkpath(struct cli_state *cli, char *path);
-BOOL cli_message_start(struct cli_state *cli, char *host, char *username,
- int *grp);
-BOOL cli_message_text(struct cli_state *cli, char *msg, int len, int grp);
-BOOL cli_message_end(struct cli_state *cli, int grp);
-BOOL cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
-BOOL get_any_dc_name(const char *domain, char *srv_name);
-
-/*The following definitions come from libsmb/credentials.c */
-
-char *credstr(const uchar *cred);
-void cred_session_key(DOM_CHAL *clnt_chal, DOM_CHAL *srv_chal, const char *pass,
- uchar session_key[8]);
-void cred_create(uchar session_key[8], DOM_CHAL *stor_cred, UTIME timestamp,
- DOM_CHAL *cred);
-int cred_assert(const DOM_CHAL *cred, uchar session_key[8],
- DOM_CHAL *stored_cred, UTIME timestamp);
-BOOL clnt_deal_with_creds(uchar sess_key[8],
- DOM_CRED *sto_clnt_cred, DOM_CRED *rcv_srv_cred);
-BOOL deal_with_creds(uchar sess_key[8],
- DOM_CRED *sto_clnt_cred,
- const DOM_CRED *rcv_clnt_cred, DOM_CRED *rtn_srv_cred);
-
-/*The following definitions come from libsmb/namequery.c */
-
-BOOL name_status(int fd,char *name,int name_type,BOOL recurse,
- struct in_addr to_ip,char *master,char *rname,
- void (*fn)(struct packet_struct *));
-struct in_addr *name_query(int fd,const char *name,int name_type, BOOL bcast,BOOL recurse,
- struct in_addr to_ip, int *count, void (*fn)(struct packet_struct *));
-FILE *startlmhosts(char *fname);
-BOOL getlmhostsent( FILE *fp, pstring name, int *name_type, struct in_addr *ipaddr);
-void endlmhosts(FILE *fp);
-BOOL is_ip_address(const char *name);
-BOOL resolve_name(const char *name, struct in_addr *return_ip, int name_type);
-BOOL resolve_srv_name(const char* srv_name, fstring dest_host,
- struct in_addr *ip);
-BOOL find_master_ip(char *group, struct in_addr *master_ip);
-
-/*The following definitions come from libsmb/nmblib.c */
-
-void debug_nmb_packet(struct packet_struct *p);
-char *nmb_namestr(struct nmb_name *n);
-void nmb_safe_namestr(struct nmb_name *n, char *str, size_t len);
-struct packet_struct *copy_packet(struct packet_struct *packet);
-void free_packet(struct packet_struct *packet);
-struct packet_struct *read_packet(int fd,enum packet_type packet_type);
-void make_nmb_name( struct nmb_name *n, const char *name, int type, const char *this_scope );
-BOOL nmb_name_equal(struct nmb_name *n1, struct nmb_name *n2);
-BOOL send_packet(struct packet_struct *p);
-struct packet_struct *receive_packet(int fd,enum packet_type type,int t);
-void sort_query_replies(char *data, int n, struct in_addr ip);
-BOOL read_nmb_sock(int c, struct nmb_state *con);
-int get_nmb_sock(void);
-char *dns_to_netbios_name(char *dns_name);
-int name_mangle( char *In, char *Out, char name_type );
-int name_extract(char *buf,int ofs,char *name);
-int name_len(char *s1);
-
-/*The following definitions come from libsmb/nterr.c */
-
-BOOL get_safe_nt_error_msg(uint32 nt_code, char *msg, size_t len);
-const char *get_nt_error_msg(uint32 nt_code);
-
-/*The following definitions come from libsmb/pwd_cache.c */
-
-void pwd_init(struct pwd_info *pwd);
-BOOL pwd_is_nullpwd(const struct pwd_info *pwd);
-void pwd_obfuscate_key(struct pwd_info *pwd, uint32 int_key, char *str_key);
-BOOL pwd_compare(const struct pwd_info *_pwd1, const 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);
-void pwd_get_cleartext(struct pwd_info *pwd, char *clr);
-void pwd_set_lm_nt_16(struct pwd_info *pwd,
- const uchar lm_pwd[16],
- const uchar nt_pwd[16]);
-void pwd_get_lm_nt_16(const struct pwd_info *pwd, uchar lm_pwd[16], uchar nt_pwd[16]);
-void pwd_make_lm_nt_16(struct pwd_info *pwd, char *clr);
-void pwd_make_lm_nt_owf2(struct pwd_info *pwd, const uchar srv_key[8],
- const char *user, const char *server, const char *domain,
- uchar sess_key[16]);
-void pwd_make_lm_nt_owf(struct pwd_info *pwd, uchar cryptkey[8],
- uchar sess_key[16]);
-void pwd_get_lm_nt_owf(struct pwd_info *pwd, uchar lm_owf[24],
- uchar *nt_owf, size_t *nt_owf_len);
-
/*The following definitions come from lib/smbrun.c */
int smbrun(char *cmd,char *outfile,BOOL shared);
-/*The following definitions come from libsmb/smbdes.c */
-
-void smbhash(uchar *out, const uchar *in, const uchar *key, int forw);
-void E_P16(uchar *p14,uchar *p16);
-void E_P24(const uchar *p21, const uchar *c8, uchar *p24);
-void D_P16(const uchar *p14, const uchar *in, uchar *out);
-void E_old_pw_hash( const uchar *p14, const uchar *in, uchar *out);
-void cred_hash1(uchar *out, const uchar *in, const uchar *key);
-void cred_hash2(uchar *out,uchar *in,uchar *key);
-void cred_hash3(uchar *out, const uchar *in,uchar *key, int forw);
-void SamOEMhash( uchar *data, const uchar *key, int val);
-void sam_pwd_hash(uint32 rid, const uchar *in, uchar *out, int forw);
-
-/*The following definitions come from libsmb/smbencrypt.c */
-
-void SMBencrypt(uchar * pwrd, uchar * c8, uchar * p24);
-void SMBNTencrypt(uchar * pwrd, uchar * c8, uchar * p24);
-void E_md4hash(uchar * pwrd, uchar * p16);
-void lm_owf_genW(const UNISTR2 * pwd, uchar p16[16]);
-void lm_owf_gen(const char *pwd, uchar p16[16]);
-void nt_owf_genW(const UNISTR2 * pwd, uchar nt_p16[16]);
-void nt_owf_gen(const char *pwd, uchar nt_p16[16]);
-void nt_lm_owf_genW(const UNISTR2 * pwd, uchar nt_p16[16], uchar lm_p16[16]);
-void nt_lm_owf_gen(const char *pwd, uchar nt_p16[16], uchar lm_p16[16]);
-void SMBOWFencrypt(const uchar pwrd[16], const uchar * c8, uchar p24[24]);
-void SMBOWFencrypt_ntv2(const uchar kr[16],
- const uchar * srv_chal, int srv_chal_len,
- const uchar * cli_chal, int cli_chal_len,
- char resp_buf[16]);
-void SMBsesskeygen_ntv2(const uchar kr[16],
- const uchar * nt_resp, char sess_key[16]);
-void SMBsesskeygen_ntv1(const uchar kr[16],
- const uchar * nt_resp, char sess_key[16]);
-void SMBgenclientchals(char *lm_cli_chal,
- char *nt_cli_chal, int *nt_cli_chal_len,
- const char *srv, const char *dom);
-void ntv2_owf_gen(const uchar owf[16],
- const char *user_n, const char *domain_n, uchar kr_buf[16]);
-void NTLMSSPOWFencrypt(const uchar pwrd[8], const uchar * ntlmchalresp,
- uchar p24[24]);
-BOOL make_oem_passwd_hash(uchar data[516],
- const char *pwrd, int new_pw_len,
- const uchar old_pw_hash[16], BOOL unicode);
-BOOL nt_encrypt_string2(STRING2 * out, const STRING2 * in, const uchar * key);
-BOOL nt_decrypt_string2(STRING2 * out, const STRING2 * in, const uchar * key);
-void create_ntlmssp_resp(struct pwd_info *pwd,
- char *domain, char *user_name, char *my_name,
- uint32 ntlmssp_cli_flgs, prs_struct * auth_resp);
-BOOL decode_pw_buffer(const char buffer[516], char *new_pwrd,
- int new_pwrd_size, uint32 * new_pw_len);
-BOOL encode_pw_buffer(char buffer[516], const char *new_pass,
- int new_pw_len, BOOL nt_pass_set);
-
-/*The following definitions come from libsmb/smberr.c */
-
-char *smb_err_msg(uint8 class, uint32 num);
-BOOL smb_safe_err_msg(uint8 class, uint32 num, char *ret, size_t len);
-BOOL smb_safe_errstr(char *inbuf, char *msg, size_t len);
-char *smb_errstr(char *inbuf);
-
/*The following definitions come from lib/snprintf.c */
@@ -451,6 +198,11 @@ void become_root(BOOL save_dir);
void unbecome_root(BOOL restore_dir);
const vuser_key *get_sec_ctx(void);
+/*The following definitions come from lib/surs.c */
+
+BOOL surs_sam_sid_to_unixid(DOM_SID *sid, uint32 type, uint32 *id, BOOL create);
+BOOL surs_unixid_to_sam_sid(uint32 id, uint32 type, DOM_SID *sid, BOOL create);
+
/*The following definitions come from lib/sursalgdomonly.c */
BOOL surs_algdomonly_sam_sid_to_unixid(DOM_SID *sid, uint32 type, uint32 *id,
@@ -465,11 +217,6 @@ BOOL surs_nt5ldap_sam_sid_to_unixid(LDAPDB *hds, DOM_SID * sid, uint32 type,
BOOL surs_nt5ldap_unixid_to_sam_sid(LDAPDB *hds, uint32 id, uint32 type,
DOM_SID * sid, BOOL create);
-/*The following definitions come from lib/surs.c */
-
-BOOL surs_sam_sid_to_unixid(DOM_SID *sid, uint32 type, uint32 *id, BOOL create);
-BOOL surs_unixid_to_sam_sid(uint32 id, uint32 type, DOM_SID *sid, BOOL create);
-
/*The following definitions come from lib/surstdb.c */
BOOL surs_tdb_sam_sid_to_unixid(DOM_SID * sid, uint32 type, uint32 * id,
@@ -542,25 +289,6 @@ const struct passwd *Get_Pwnam(char *user,BOOL allow_change);
BOOL user_ok(char *user,int snum);
BOOL user_in_list(char *user,char *list);
-/*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_unistr_array(uint32 num_entries, UNISTR2 **entries);
-UNISTR2* add_unistr_to_array(uint32 *len, UNISTR2 ***array, UNISTR2 *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.c */
BOOL init_myworkgroup(void);
@@ -668,6 +396,25 @@ char *passdb_path(char *name);
char *lock_path(char *name);
const char *get_sid_name_use_str(uint32 sid_name_use);
+/*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_unistr_array(uint32 num_entries, UNISTR2 **entries);
+UNISTR2* add_unistr_to_array(uint32 *len, UNISTR2 ***array, UNISTR2 *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);
@@ -883,6 +630,259 @@ BOOL tdb_lookup_vuid( const vuser_key *uk, user_struct **usr);
BOOL tdb_store_vuid( const vuser_key *uk, user_struct *usr);
BOOL vuid_init_db(void);
+/*The following definitions come from libsmb/clientgen.c */
+
+int cli_set_port(struct cli_state *cli, int port);
+char *cli_errstr(struct cli_state *cli);
+void cli_safe_smb_errstr(struct cli_state *cli, char *msg, size_t len);
+BOOL get_safe_rap_errstr(int rap_error, char *err_msg, size_t msglen);
+void cli_safe_errstr(struct cli_state *cli, char *err_msg, size_t msglen);
+BOOL cli_send_trans(struct cli_state *cli, int trans,
+ char *name, int pipe_name_len,
+ int fid, int flags,
+ uint16 *setup, int lsetup, int msetup,
+ char *param, int lparam, int mparam,
+ char *data, int ldata, int mdata);
+BOOL cli_api_pipe(struct cli_state *cli, char *pipe_name, int pipe_name_len,
+ uint16 *setup, uint32 setup_count, uint32 max_setup_count,
+ char *params, uint32 param_count, uint32 max_param_count,
+ char *data, uint32 data_count, uint32 max_data_count,
+ char **rparam, uint32 *rparam_count,
+ char **rdata, uint32 *rdata_count);
+BOOL cli_api(struct cli_state *cli,
+ char *param, int prcnt, int mprcnt,
+ char *data, int drcnt, int mdrcnt,
+ char **rparam, int *rprcnt,
+ char **rdata, int *rdrcnt);
+BOOL cli_NetWkstaUserLogon(struct cli_state *cli,char *user, char *workstation);
+BOOL cli_RNetShareEnum(struct cli_state *cli, void (*fn)(const char *, uint32, const char *));
+BOOL cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype,
+ void (*fn)(const char *, uint32, const char *));
+BOOL cli_session_setup_x(struct cli_state *cli,
+ char *user,
+ char *pass, int passlen,
+ char *ntpass, int ntpasslen,
+ char *user_domain);
+BOOL cli_session_setup(struct cli_state *cli,
+ char *myhostname, char *user,
+ char *pass, int passlen,
+ char *ntpass, int ntpasslen,
+ char *user_domain);
+BOOL cli_ulogoff(struct cli_state *cli);
+BOOL cli_send_tconX(struct cli_state *cli,
+ char *share, char *dev, char *pass, int passlen);
+BOOL cli_tdis(struct cli_state *cli);
+BOOL cli_rename(struct cli_state *cli, char *fname_src, char *fname_dst);
+BOOL cli_unlink(struct cli_state *cli, char *fname);
+BOOL cli_mkdir(struct cli_state *cli, char *dname);
+BOOL cli_rmdir(struct cli_state *cli, char *dname);
+int cli_nt_create(struct cli_state *cli, const char *fname);
+int cli_open(struct cli_state *cli, const char *fname,
+ int flags, int share_mode);
+BOOL cli_close(struct cli_state *cli, int fnum);
+BOOL cli_lock(struct cli_state *cli, int fnum, uint32 offset, uint32 len, int timeout);
+BOOL cli_unlock(struct cli_state *cli, int fnum, uint32 offset, uint32 len, int timeout);
+size_t cli_read_one(struct cli_state *cli, int fnum, char *buf, off_t offset, size_t size);
+size_t cli_read(struct cli_state *cli, int fnum, char *buf, off_t offset, size_t size, BOOL overlap);
+ssize_t cli_write(struct cli_state *cli,
+ int fnum, uint16 write_mode,
+ char *buf, off_t offset, size_t size, size_t bytes_left);
+BOOL cli_getattrE(struct cli_state *cli, int fd,
+ uint16 *attr, size_t *size,
+ time_t *c_time, time_t *a_time, time_t *m_time);
+BOOL cli_getatr(struct cli_state *cli, char *fname,
+ uint16 *attr, size_t *size, time_t *t);
+BOOL cli_setatr(struct cli_state *cli, char *fname, uint16 attr, time_t t);
+BOOL cli_qpathinfo(struct cli_state *cli, const char *fname,
+ time_t *c_time, time_t *a_time, time_t *m_time,
+ size_t *size, uint16 *mode);
+BOOL cli_qpathinfo2(struct cli_state *cli, const char *fname,
+ time_t *c_time, time_t *a_time, time_t *m_time,
+ time_t *w_time, size_t *size, uint16 *mode,
+ SMB_INO_T *ino);
+BOOL cli_qfileinfo(struct cli_state *cli, int fnum,
+ uint16 *mode, size_t *size,
+ time_t *c_time, time_t *a_time, time_t *m_time,
+ time_t *w_time, SMB_INO_T *ino);
+int cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
+ void (*fn)(file_info *, const char *));
+BOOL cli_oem_change_password(struct cli_state *cli, const char *user, const char *new_password,
+ const char *old_password);
+BOOL cli_negprot(struct cli_state *cli);
+BOOL cli_session_request(struct cli_state *cli,
+ struct nmb_name *calling, struct nmb_name *called);
+BOOL cli_connect(struct cli_state *cli, const char *host, struct in_addr *ip);
+void cli_init_creds(struct cli_state *cli, const struct ntuser_creds *usr);
+struct cli_state *cli_initialise(struct cli_state *cli);
+void cli_close_socket(struct cli_state *cli);
+void cli_shutdown(struct cli_state *cli);
+int cli_error(struct cli_state *cli, uint8 *eclass, uint32 *num);
+void cli_sockopt(struct cli_state *cli, char *options);
+uint16 cli_setpid(struct cli_state *cli, uint16 pid);
+BOOL cli_reestablish_connection(struct cli_state *cli);
+BOOL cli_establish_connection(struct cli_state *cli,
+ const char *dest_host, struct in_addr *dest_ip,
+ struct nmb_name *calling, struct nmb_name *called,
+ char *service, char *service_type,
+ BOOL do_shutdown, BOOL do_tcon);
+BOOL cli_connect_auth(struct cli_state *cli,
+ const char* desthost,
+ struct in_addr *dest_ip,
+ const struct ntuser_creds *usr);
+BOOL cli_connect_servers_auth(struct cli_state *cli,
+ char *p,
+ const struct ntuser_creds *usr);
+BOOL cli_connect_serverlist(struct cli_state *cli, char *p);
+int cli_printjob_del(struct cli_state *cli, int job);
+int cli_print_queue(struct cli_state *cli,
+ void (*fn)(struct print_job_info *));
+BOOL cli_chkpath(struct cli_state *cli, char *path);
+BOOL cli_message_start(struct cli_state *cli, char *host, char *username,
+ int *grp);
+BOOL cli_message_text(struct cli_state *cli, char *msg, int len, int grp);
+BOOL cli_message_end(struct cli_state *cli, int grp);
+BOOL cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
+BOOL get_any_dc_name(const char *domain, char *srv_name);
+
+/*The following definitions come from libsmb/credentials.c */
+
+char *credstr(const uchar *cred);
+void cred_session_key(DOM_CHAL *clnt_chal, DOM_CHAL *srv_chal, const char *pass,
+ uchar session_key[8]);
+void cred_create(uchar session_key[8], DOM_CHAL *stor_cred, UTIME timestamp,
+ DOM_CHAL *cred);
+int cred_assert(const DOM_CHAL *cred, uchar session_key[8],
+ DOM_CHAL *stored_cred, UTIME timestamp);
+BOOL clnt_deal_with_creds(uchar sess_key[8],
+ DOM_CRED *sto_clnt_cred, DOM_CRED *rcv_srv_cred);
+BOOL deal_with_creds(uchar sess_key[8],
+ DOM_CRED *sto_clnt_cred,
+ const DOM_CRED *rcv_clnt_cred, DOM_CRED *rtn_srv_cred);
+
+/*The following definitions come from libsmb/namequery.c */
+
+BOOL name_status(int fd,char *name,int name_type,BOOL recurse,
+ struct in_addr to_ip,char *master,char *rname,
+ void (*fn)(struct packet_struct *));
+struct in_addr *name_query(int fd,const char *name,int name_type, BOOL bcast,BOOL recurse,
+ struct in_addr to_ip, int *count, void (*fn)(struct packet_struct *));
+FILE *startlmhosts(char *fname);
+BOOL getlmhostsent( FILE *fp, pstring name, int *name_type, struct in_addr *ipaddr);
+void endlmhosts(FILE *fp);
+BOOL is_ip_address(const char *name);
+BOOL resolve_name(const char *name, struct in_addr *return_ip, int name_type);
+BOOL resolve_srv_name(const char* srv_name, fstring dest_host,
+ struct in_addr *ip);
+BOOL find_master_ip(char *group, struct in_addr *master_ip);
+
+/*The following definitions come from libsmb/nmblib.c */
+
+void debug_nmb_packet(struct packet_struct *p);
+char *nmb_namestr(struct nmb_name *n);
+void nmb_safe_namestr(struct nmb_name *n, char *str, size_t len);
+struct packet_struct *copy_packet(struct packet_struct *packet);
+void free_packet(struct packet_struct *packet);
+struct packet_struct *read_packet(int fd,enum packet_type packet_type);
+void make_nmb_name( struct nmb_name *n, const char *name, int type, const char *this_scope );
+BOOL nmb_name_equal(struct nmb_name *n1, struct nmb_name *n2);
+BOOL send_packet(struct packet_struct *p);
+struct packet_struct *receive_packet(int fd,enum packet_type type,int t);
+void sort_query_replies(char *data, int n, struct in_addr ip);
+BOOL read_nmb_sock(int c, struct nmb_state *con);
+int get_nmb_sock(void);
+char *dns_to_netbios_name(char *dns_name);
+int name_mangle( char *In, char *Out, char name_type );
+int name_extract(char *buf,int ofs,char *name);
+int name_len(char *s1);
+
+/*The following definitions come from libsmb/nterr.c */
+
+BOOL get_safe_nt_error_msg(uint32 nt_code, char *msg, size_t len);
+const char *get_nt_error_msg(uint32 nt_code);
+
+/*The following definitions come from libsmb/pwd_cache.c */
+
+void pwd_init(struct pwd_info *pwd);
+BOOL pwd_is_nullpwd(const struct pwd_info *pwd);
+void pwd_obfuscate_key(struct pwd_info *pwd, uint32 int_key, char *str_key);
+BOOL pwd_compare(const struct pwd_info *_pwd1, const 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);
+void pwd_get_cleartext(struct pwd_info *pwd, char *clr);
+void pwd_set_lm_nt_16(struct pwd_info *pwd,
+ const uchar lm_pwd[16],
+ const uchar nt_pwd[16]);
+void pwd_get_lm_nt_16(const struct pwd_info *pwd, uchar lm_pwd[16], uchar nt_pwd[16]);
+void pwd_make_lm_nt_16(struct pwd_info *pwd, char *clr);
+void pwd_make_lm_nt_owf2(struct pwd_info *pwd, const uchar srv_key[8],
+ const char *user, const char *server, const char *domain,
+ uchar sess_key[16]);
+void pwd_make_lm_nt_owf(struct pwd_info *pwd, uchar cryptkey[8],
+ uchar sess_key[16]);
+void pwd_get_lm_nt_owf(struct pwd_info *pwd, uchar lm_owf[24],
+ uchar *nt_owf, size_t *nt_owf_len);
+
+/*The following definitions come from libsmb/smbdes.c */
+
+void smbhash(uchar *out, const uchar *in, const uchar *key, int forw);
+void E_P16(uchar *p14,uchar *p16);
+void E_P24(const uchar *p21, const uchar *c8, uchar *p24);
+void D_P16(const uchar *p14, const uchar *in, uchar *out);
+void E_old_pw_hash( const uchar *p14, const uchar *in, uchar *out);
+void cred_hash1(uchar *out, const uchar *in, const uchar *key);
+void cred_hash2(uchar *out,uchar *in,uchar *key);
+void cred_hash3(uchar *out, const uchar *in,uchar *key, int forw);
+void SamOEMhash( uchar *data, const uchar *key, int val);
+void sam_pwd_hash(uint32 rid, const uchar *in, uchar *out, int forw);
+
+/*The following definitions come from libsmb/smbencrypt.c */
+
+void SMBencrypt(uchar * pwrd, uchar * c8, uchar * p24);
+void SMBNTencrypt(uchar * pwrd, uchar * c8, uchar * p24);
+void E_md4hash(uchar * pwrd, uchar * p16);
+void lm_owf_genW(const UNISTR2 * pwd, uchar p16[16]);
+void lm_owf_gen(const char *pwd, uchar p16[16]);
+void nt_owf_genW(const UNISTR2 * pwd, uchar nt_p16[16]);
+void nt_owf_gen(const char *pwd, uchar nt_p16[16]);
+void nt_lm_owf_genW(const UNISTR2 * pwd, uchar nt_p16[16], uchar lm_p16[16]);
+void nt_lm_owf_gen(const char *pwd, uchar nt_p16[16], uchar lm_p16[16]);
+void SMBOWFencrypt(const uchar pwrd[16], const uchar * c8, uchar p24[24]);
+void SMBOWFencrypt_ntv2(const uchar kr[16],
+ const uchar * srv_chal, int srv_chal_len,
+ const uchar * cli_chal, int cli_chal_len,
+ char resp_buf[16]);
+void SMBsesskeygen_ntv2(const uchar kr[16],
+ const uchar * nt_resp, char sess_key[16]);
+void SMBsesskeygen_ntv1(const uchar kr[16],
+ const uchar * nt_resp, char sess_key[16]);
+void SMBgenclientchals(char *lm_cli_chal,
+ char *nt_cli_chal, int *nt_cli_chal_len,
+ const char *srv, const char *dom);
+void ntv2_owf_gen(const uchar owf[16],
+ const char *user_n, const char *domain_n, uchar kr_buf[16]);
+void NTLMSSPOWFencrypt(const uchar pwrd[8], const uchar * ntlmchalresp,
+ uchar p24[24]);
+BOOL make_oem_passwd_hash(uchar data[516],
+ const char *pwrd, int new_pw_len,
+ const uchar old_pw_hash[16], BOOL unicode);
+BOOL nt_encrypt_string2(STRING2 * out, const STRING2 * in, const uchar * key);
+BOOL nt_decrypt_string2(STRING2 * out, const STRING2 * in, const uchar * key);
+void create_ntlmssp_resp(struct pwd_info *pwd,
+ char *domain, char *user_name, char *my_name,
+ uint32 ntlmssp_cli_flgs, prs_struct * auth_resp);
+BOOL decode_pw_buffer(const char buffer[516], char *new_pwrd,
+ int new_pwrd_size, uint32 * new_pw_len);
+BOOL encode_pw_buffer(char buffer[516], const char *new_pass,
+ int new_pw_len, BOOL nt_pass_set);
+
+/*The following definitions come from libsmb/smberr.c */
+
+char *smb_err_msg(uint8 class, uint32 num);
+BOOL smb_safe_err_msg(uint8 class, uint32 num, char *ret, size_t len);
+BOOL smb_safe_errstr(char *inbuf, char *msg, size_t len);
+char *smb_errstr(char *inbuf);
+
/*The following definitions come from nsswitch/winbindd.c */
void exit_server(char *reason);
@@ -2231,8 +2231,6 @@ BOOL samr_io_group_info1(char *desc, GROUP_INFO1 * gr1, prs_struct * ps,
BOOL make_samr_group_info4(GROUP_INFO4 * gr4, const char *acct_desc);
BOOL samr_io_group_info4(char *desc, GROUP_INFO4 * gr4, prs_struct * ps,
int depth);
-BOOL samr_group_info_ctr(char *desc, GROUP_INFO_CTR * ctr, prs_struct * ps,
- int depth);
BOOL make_samr_q_create_dom_group(SAMR_Q_CREATE_DOM_GROUP * q_e,
POLICY_HND * pol, const char *acct_desc);
BOOL samr_io_q_create_dom_group(char *desc, SAMR_Q_CREATE_DOM_GROUP * q_e,
diff --git a/source/lsarpcd/srv_lsa_samdb.c b/source/lsarpcd/srv_lsa_samdb.c
index 99e569dc7da..738f66cbfab 100644
--- a/source/lsarpcd/srv_lsa_samdb.c
+++ b/source/lsarpcd/srv_lsa_samdb.c
@@ -81,7 +81,7 @@ static void secnamefree(void*inf)
/****************************************************************************
set tdb secret name
****************************************************************************/
-BOOL set_tdbsecname(struct policy_cache *cache, POLICY_HND *hnd,
+static BOOL set_tdbsecname(struct policy_cache *cache, POLICY_HND *hnd,
TDB_CONTEXT *tdb,
const UNISTR2 *name)
{
@@ -111,7 +111,7 @@ BOOL set_tdbsecname(struct policy_cache *cache, POLICY_HND *hnd,
/****************************************************************************
get tdb secret name
****************************************************************************/
-BOOL get_tdbsecname(struct policy_cache *cache, const POLICY_HND *hnd,
+static BOOL get_tdbsecname(struct policy_cache *cache, const POLICY_HND *hnd,
TDB_CONTEXT **tdb,
UNISTR2 *name)
{
@@ -152,6 +152,9 @@ uint32 _lsa_open_policy2(const UNISTR2 *server_name, POLICY_HND *hnd,
return NT_STATUS_ACCESS_DENIED;
}
+ policy_hnd_set_name(get_global_hnd_cache(),
+ hnd, "open_policy2");
+
return NT_STATUS_NOPROBLEMO;
}
@@ -159,8 +162,8 @@ uint32 _lsa_open_policy2(const UNISTR2 *server_name, POLICY_HND *hnd,
lsa_reply_open_policy
***************************************************************************/
uint32 _lsa_open_policy(const UNISTR2 *server_name, POLICY_HND *hnd,
- const LSA_OBJ_ATTR *attr,
- uint32 des_access)
+ const LSA_OBJ_ATTR *attr,
+ uint32 des_access)
{
if (hnd == NULL)
{
@@ -174,6 +177,9 @@ uint32 _lsa_open_policy(const UNISTR2 *server_name, POLICY_HND *hnd,
return NT_STATUS_ACCESS_DENIED;
}
+ policy_hnd_set_name(get_global_hnd_cache(),
+ hnd, "open_policy");
+
return NT_STATUS_NOPROBLEMO;
}
@@ -663,6 +669,7 @@ uint32 _lsa_create_secret(const POLICY_HND *hnd,
if (tdb_lookup_secret(tdb, secret_name, NULL))
{
DEBUG(10,("_lsa_create_secret: secret exists\n"));
+ /* XXX - shouldn't tdb be closed here? (Elrond) */
return NT_STATUS_ACCESS_DENIED;
}
@@ -674,6 +681,9 @@ uint32 _lsa_create_secret(const POLICY_HND *hnd,
return NT_STATUS_ACCESS_DENIED;
}
+ policy_hnd_set_name(get_global_hnd_cache(),
+ hnd_secret, "secret (create)");
+
if (!set_tdbsecname(get_global_hnd_cache(), hnd_secret, tdb, secret_name))
{
close_policy_hnd(get_global_hnd_cache(), hnd_secret);
@@ -714,6 +724,7 @@ uint32 _lsa_open_secret(const POLICY_HND *hnd,
if (!tdb_lookup_secret(tdb, secret_name, NULL))
{
+ /* XXX - shouldn't tdb be closed here? (Elrond) */
return NT_STATUS_OBJECT_NAME_NOT_FOUND;
}
@@ -725,6 +736,9 @@ uint32 _lsa_open_secret(const POLICY_HND *hnd,
return NT_STATUS_ACCESS_DENIED;
}
+ policy_hnd_set_name(get_global_hnd_cache(),
+ hnd_secret, "secret (open)");
+
if (!set_tdbsecname(get_global_hnd_cache(), hnd_secret, tdb, secret_name))
{
close_policy_hnd(get_global_hnd_cache(), hnd_secret);
diff --git a/source/passdb/sampass.c b/source/passdb/sampass.c
index c64525d9552..2f39fea2baa 100644
--- a/source/passdb/sampass.c
+++ b/source/passdb/sampass.c
@@ -1,6 +1,7 @@
/*
* Unix SMB/Netbios implementation. Version 1.9. SMB parameters and setup
* Copyright (C) Andrew Tridgell 1992-1998 Modified by Jeremy Allison 1995.
+ * Copyright (C) Elrond 2000
*
* 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
@@ -97,7 +98,7 @@ static struct sam_passwd *getsamfile21pwent(void *vp)
ZERO_STRUCT(bogus_user_struct);
- user = pwdb_smb_to_sam(getsmbfilepwent(vp));
+ user = pwdb_smb_to_sam(pwdb_smb_map_names(getsmbfilepwent(vp)));
if (user == NULL)
{
return NULL;
@@ -114,6 +115,8 @@ static struct sam_passwd *getsamfile21pwent(void *vp)
/* HACK to make %U work in substitutions below */
fstrcpy(bogus_user_struct.requested_name, user->nt_name);
fstrcpy(bogus_user_struct.name , user->unix_name);
+ DEBUG(7, ("getsamfile21pwent: nt_name=%s, unix_name=%s\n",
+ user->nt_name, user->unix_name));
pstrcpy(full_name , "");
pstrcpy(logon_script , lp_logon_script (&bogus_user_struct));
diff --git a/source/rpc_parse/parse_prs.c b/source/rpc_parse/parse_prs.c
index 2a2d4ebe98b..f04c5420e50 100644
--- a/source/rpc_parse/parse_prs.c
+++ b/source/rpc_parse/parse_prs.c
@@ -593,7 +593,7 @@ BOOL prs_set_offset(prs_struct *ps, uint32 offset)
return True;
}
- if(!prs_grow(ps, offset - ps->offset))
+ if(!prs_grow(ps, offset))
return False;
ps->offset = offset;
diff --git a/source/rpc_parse/parse_samr.c b/source/rpc_parse/parse_samr.c
index eaeffb2a737..7929c4fac7a 100644
--- a/source/rpc_parse/parse_samr.c
+++ b/source/rpc_parse/parse_samr.c
@@ -40,7 +40,7 @@ BOOL make_samr_q_close_hnd(SAMR_Q_CLOSE_HND * q_c, POLICY_HND * hnd)
DEBUG(5, ("make_samr_q_close_hnd\n"));
- memcpy(&(q_c->pol), hnd, sizeof(q_c->pol));
+ q_c->pol = *hnd;
return True;
}
@@ -59,10 +59,7 @@ BOOL samr_io_q_close_hnd(char *desc, SAMR_Q_CLOSE_HND * q_u, prs_struct * ps,
prs_align(ps);
- smb_io_pol_hnd("pol", &(q_u->pol), ps, depth);
- prs_align(ps);
-
- return True;
+ return smb_io_pol_hnd("pol", &(q_u->pol), ps, depth);
}
/*******************************************************************
@@ -80,7 +77,6 @@ BOOL samr_io_r_close_hnd(char *desc, SAMR_R_CLOSE_HND * r_u, prs_struct * ps,
prs_align(ps);
smb_io_pol_hnd("pol", &(r_u->pol), ps, depth);
- prs_align(ps);
prs_uint32("status", ps, depth, &(r_u->status));
@@ -100,7 +96,7 @@ BOOL make_samr_q_lookup_domain(SAMR_Q_LOOKUP_DOMAIN * q_u,
DEBUG(5, ("make_samr_q_lookup_domain\n"));
- memcpy(&(q_u->connect_pol), pol, sizeof(*pol));
+ q_u->connect_pol = *pol;
make_uni_hdr(&(q_u->hdr_domain), len_name);
make_unistr2(&(q_u->uni_domain), dom_name, len_name);
@@ -123,7 +119,6 @@ BOOL samr_io_q_lookup_domain(char *desc, SAMR_Q_LOOKUP_DOMAIN * q_u,
prs_align(ps);
smb_io_pol_hnd("connect_pol", &(q_u->connect_pol), ps, depth);
- prs_align(ps);
smb_io_unihdr("hdr_domain", &(q_u->hdr_domain), ps, depth);
smb_io_unistr2("uni_domain", &(q_u->uni_domain),
@@ -193,7 +188,7 @@ BOOL make_samr_q_unknown_2d(SAMR_Q_UNKNOWN_2D * q_u,
DEBUG(5, ("samr_make_samr_q_unknown_2d\n"));
- memcpy(&q_u->dom_pol, dom_pol, sizeof(q_u->dom_pol));
+ q_u->dom_pol = *dom_pol;
make_dom_sid2(&(q_u->sid), sid);
return True;
@@ -214,7 +209,6 @@ BOOL samr_io_q_unknown_2d(char *desc, SAMR_Q_UNKNOWN_2D * q_u,
prs_align(ps);
smb_io_pol_hnd("domain_pol", &(q_u->dom_pol), ps, depth);
- prs_align(ps);
smb_io_dom_sid2("sid", &(q_u->sid), ps, depth);
prs_align(ps);
@@ -254,7 +248,7 @@ BOOL make_samr_q_open_domain(SAMR_Q_OPEN_DOMAIN * q_u,
DEBUG(5, ("samr_make_samr_q_open_domain\n"));
- memcpy(&q_u->connect_pol, connect_pol, sizeof(q_u->connect_pol));
+ q_u->connect_pol = *connect_pol;
q_u->flags = flags;
make_dom_sid2(&(q_u->dom_sid), sid);
@@ -276,7 +270,6 @@ BOOL samr_io_q_open_domain(char *desc, SAMR_Q_OPEN_DOMAIN * q_u,
prs_align(ps);
smb_io_pol_hnd("connect_pol", &(q_u->connect_pol), ps, depth);
- prs_align(ps);
prs_uint32("flags", ps, depth, &(q_u->flags));
@@ -302,7 +295,6 @@ BOOL samr_io_r_open_domain(char *desc, SAMR_R_OPEN_DOMAIN * r_u,
prs_align(ps);
smb_io_pol_hnd("domain_pol", &(r_u->domain_pol), ps, depth);
- prs_align(ps);
prs_uint32("status", ps, depth, &(r_u->status));
@@ -320,12 +312,11 @@ BOOL make_samr_q_get_usrdom_pwinfo(SAMR_Q_GET_USRDOM_PWINFO * q_u,
DEBUG(5, ("samr_make_samr_q_get_usrdom_pwinfo\n"));
- memcpy(&q_u->user_pol, user_pol, sizeof(q_u->user_pol));
+ q_u->user_pol = *user_pol;
return True;
}
-
/*******************************************************************
reads or writes a structure.
********************************************************************/
@@ -340,10 +331,7 @@ BOOL samr_io_q_get_usrdom_pwinfo(char *desc, SAMR_Q_GET_USRDOM_PWINFO * q_u,
prs_align(ps);
- smb_io_pol_hnd("user_pol", &(q_u->user_pol), ps, depth);
- prs_align(ps);
-
- return True;
+ return smb_io_pol_hnd("user_pol", &(q_u->user_pol), ps, depth);
}
/*******************************************************************
@@ -401,7 +389,6 @@ BOOL samr_io_q_query_sec_obj(char *desc, SAMR_Q_QUERY_SEC_OBJ * q_u,
prs_align(ps);
smb_io_pol_hnd("user_pol", &(q_u->user_pol), ps, depth);
- prs_align(ps);
prs_uint32("sec_info", ps, depth, &(q_u->sec_info));
@@ -440,7 +427,6 @@ BOOL samr_io_q_query_dom_info(char *desc, SAMR_Q_QUERY_DOMAIN_INFO * q_u,
prs_align(ps);
smb_io_pol_hnd("domain_pol", &(q_u->domain_pol), ps, depth);
- prs_align(ps);
prs_uint16("switch_value", ps, depth, &(q_u->switch_value));
prs_align(ps);
@@ -480,7 +466,6 @@ static BOOL sam_io_unk_info3(char *desc, SAM_UNK_INFO_3 * u_3,
prs_align(ps);
-
return True;
}
@@ -517,7 +502,6 @@ static BOOL sam_io_unk_info6(char *desc, SAM_UNK_INFO_6 * u_6,
prs_align(ps);
-
return True;
}
@@ -549,7 +533,6 @@ static BOOL sam_io_unk_info7(char *desc, SAM_UNK_INFO_7 * u_7,
prs_uint16("unknown_0", ps, depth, &u_7->unknown_0); /* 0x0003 */
prs_align(ps);
-
return True;
}
@@ -672,10 +655,8 @@ static BOOL sam_io_unk_info2(char *desc, SAM_UNK_INFO_2 * u_2,
prs_align(ps);
smb_io_unistr2("uni_server", &u_2->uni_server, u_2->hdr_server.buffer,
ps, depth);
-
prs_align(ps);
-
return True;
}
@@ -756,7 +737,7 @@ BOOL samr_io_r_query_dom_info(char *desc, SAMR_R_QUERY_DOMAIN_INFO * r_u,
prs_align(ps);
- prs_uint32("ptr_0 ", ps, depth, &(r_u->ptr_0));
+ prs_uint32("ptr_0 ", ps, depth, &(r_u->ptr_0));
if (r_u->ptr_0 != 0 && r_u->ctr != NULL)
{
@@ -812,15 +793,13 @@ BOOL samr_io_r_query_dom_info(char *desc, SAMR_R_QUERY_DOMAIN_INFO * r_u,
DEBUG(3,
("samr_io_r_query_dom_info: unknown switch level 0x%x\n",
r_u->switch_value));
- r_u->status =
- 0xC0000000 |
- NT_STATUS_INVALID_INFO_CLASS;
+ r_u->status = NT_STATUS_INVALID_INFO_CLASS;
return False;
}
}
}
- prs_uint32("status ", ps, depth, &(r_u->status));
+ prs_uint32("status", ps, depth, &(r_u->status));
return True;
}
@@ -1215,8 +1194,7 @@ BOOL samr_io_q_enum_dom_users(char *desc, SAMR_Q_ENUM_DOM_USERS * q_e,
prs_align(ps);
- smb_io_pol_hnd("pol", &(q_e->pol), ps, depth);
- prs_align(ps);
+ smb_io_pol_hnd("domain_pol", &(q_e->pol), ps, depth);
prs_uint32("start_idx", ps, depth, &(q_e->start_idx));
prs_uint16("acb_mask ", ps, depth, &(q_e->acb_mask));
@@ -1287,17 +1265,10 @@ BOOL samr_io_r_enum_dom_users(char *desc, SAMR_R_ENUM_DOM_USERS * r_u,
prs_uint32("ptr_entries2", ps, depth, &(r_u->ptr_entries2));
prs_uint32("num_entries3", ps, depth, &(r_u->num_entries3));
- if (ps->io)
+ if (UNMARSHALLING(ps) && (r_u->num_entries2 != 0))
{
- r_u->sam =
- (SAM_ENTRY *) Realloc(NULL,
- r_u->num_entries2 *
- sizeof(r_u->sam[0]));
- r_u->uni_acct_name =
- (UNISTR2 *) Realloc(NULL,
- r_u->num_entries2 *
- sizeof(r_u->
- uni_acct_name[0]));
+ r_u->sam = g_new(SAM_ENTRY, r_u->num_entries2);
+ r_u->uni_acct_name = g_new(UNISTR2, r_u->num_entries2);
}
if ((r_u->sam == NULL || r_u->uni_acct_name == NULL)
@@ -1306,8 +1277,7 @@ BOOL samr_io_r_enum_dom_users(char *desc, SAMR_R_ENUM_DOM_USERS * r_u,
DEBUG(0,
("NULL pointers in SAMR_R_ENUM_DOM_USERS\n"));
r_u->num_entries4 = 0;
- r_u->status =
- 0xC0000000 | NT_STATUS_MEMORY_NOT_ALLOCATED;
+ r_u->status = NT_STATUS_MEMORY_NOT_ALLOCATED;
return False;
}
@@ -1372,7 +1342,6 @@ BOOL samr_io_q_query_dispinfo(char *desc, SAMR_Q_QUERY_DISPINFO * q_e,
prs_align(ps);
smb_io_pol_hnd("domain_pol", &(q_e->domain_pol), ps, depth);
- prs_align(ps);
prs_uint16("switch_level", ps, depth, &(q_e->switch_level));
prs_align(ps);
@@ -1937,7 +1906,6 @@ BOOL samr_io_r_open_group(char *desc, SAMR_R_OPEN_GROUP * r_u,
prs_align(ps);
smb_io_pol_hnd("pol", &(r_u->pol), ps, depth);
- prs_align(ps);
prs_uint32("status", ps, depth, &(r_u->status));
@@ -2048,8 +2016,8 @@ BOOL samr_io_group_info4(char *desc, GROUP_INFO4 * gr4, prs_struct * ps,
/*******************************************************************
reads or writes a structure.
********************************************************************/
-BOOL samr_group_info_ctr(char *desc, GROUP_INFO_CTR * ctr, prs_struct * ps,
- int depth)
+static BOOL samr_group_info_ctr(char *desc, GROUP_INFO_CTR *ctr,
+ prs_struct *ps, int depth)
{
if (ctr == NULL)
return False;
@@ -2126,7 +2094,6 @@ BOOL samr_io_q_create_dom_group(char *desc, SAMR_Q_CREATE_DOM_GROUP * q_e,
prs_align(ps);
smb_io_pol_hnd("pol", &(q_e->pol), ps, depth);
- prs_align(ps);
smb_io_unihdr("hdr_acct_desc", &(q_e->hdr_acct_desc), ps, depth);
smb_io_unistr2("uni_acct_desc", &(q_e->uni_acct_desc),
@@ -2153,7 +2120,6 @@ BOOL samr_io_r_create_dom_group(char *desc, SAMR_R_CREATE_DOM_GROUP * r_u,
prs_align(ps);
smb_io_pol_hnd("pol", &(r_u->pol), ps, depth);
- prs_align(ps);
prs_uint32("rid ", ps, depth, &(r_u->rid));
prs_uint32("status", ps, depth, &(r_u->status));
@@ -2191,9 +2157,7 @@ BOOL samr_io_q_delete_dom_group(char *desc, SAMR_Q_DELETE_DOM_GROUP * q_u,
prs_align(ps);
- smb_io_pol_hnd("group_pol", &(q_u->group_pol), ps, depth);
-
- return True;
+ return smb_io_pol_hnd("group_pol", &(q_u->group_pol), ps, depth);
}
/*******************************************************************
@@ -2250,9 +2214,8 @@ BOOL samr_io_q_del_groupmem(char *desc, SAMR_Q_DEL_GROUPMEM * q_e,
prs_align(ps);
smb_io_pol_hnd("pol", &(q_e->pol), ps, depth);
- prs_align(ps);
- prs_uint32("rid ", ps, depth, &(q_e->rid));
+ prs_uint32("rid", ps, depth, &(q_e->rid));
return True;
}
@@ -2330,7 +2293,6 @@ BOOL samr_io_q_add_groupmem(char *desc, SAMR_Q_ADD_GROUPMEM * q_e,
prs_align(ps);
smb_io_pol_hnd("pol", &(q_e->pol), ps, depth);
- prs_align(ps);
prs_uint32("rid ", ps, depth, &(q_e->rid));
prs_uint32("unknown", ps, depth, &(q_e->unknown));
@@ -2409,7 +2371,6 @@ BOOL samr_io_q_set_groupinfo(char *desc, SAMR_Q_SET_GROUPINFO * q_e,
prs_align(ps);
smb_io_pol_hnd("pol", &(q_e->pol), ps, depth);
- prs_align(ps);
samr_group_info_ctr("ctr", q_e->ctr, ps, depth);
@@ -2486,7 +2447,6 @@ BOOL samr_io_q_query_groupinfo(char *desc, SAMR_Q_QUERY_GROUPINFO * q_e,
prs_align(ps);
smb_io_pol_hnd("pol", &(q_e->pol), ps, depth);
- prs_align(ps);
prs_uint16("switch_level", ps, depth, &(q_e->switch_level));
@@ -2568,9 +2528,7 @@ BOOL samr_io_q_query_groupmem(char *desc, SAMR_Q_QUERY_GROUPMEM * q_u,
prs_align(ps);
- smb_io_pol_hnd("group_pol", &(q_u->group_pol), ps, depth);
-
- return True;
+ return smb_io_pol_hnd("group_pol", &(q_u->group_pol), ps, depth);
}
/*******************************************************************
@@ -2720,12 +2678,11 @@ BOOL make_samr_q_query_usergroups(SAMR_Q_QUERY_USERGROUPS * q_u,
DEBUG(5, ("make_samr_q_query_usergroups\n"));
- memcpy(&(q_u->pol), hnd, sizeof(q_u->pol));
+ q_u->pol = *hnd;
return True;
}
-
/*******************************************************************
reads or writes a structure.
********************************************************************/
@@ -2740,10 +2697,7 @@ BOOL samr_io_q_query_usergroups(char *desc, SAMR_Q_QUERY_USERGROUPS * q_u,
prs_align(ps);
- smb_io_pol_hnd("pol", &(q_u->pol), ps, depth);
- prs_align(ps);
-
- return True;
+ return smb_io_pol_hnd("pol", &(q_u->pol), ps, depth);
}
/*******************************************************************
@@ -2799,7 +2753,7 @@ BOOL samr_io_gids(char *desc, uint32 * num_gids, DOM_GID ** gid,
if ((*num_gids) != 0)
{
- if (ps->io)
+ if (UNMARSHALLING(ps))
{
(*gid) = g_renew(DOM_GID, (*gid), (*num_gids));
}
@@ -2892,7 +2846,6 @@ BOOL samr_io_q_enum_domains(char *desc, SAMR_Q_ENUM_DOMAINS * q_e,
prs_align(ps);
smb_io_pol_hnd("pol", &(q_e->pol), ps, depth);
- prs_align(ps);
prs_uint32("start_idx", ps, depth, &(q_e->start_idx));
prs_uint32("max_size ", ps, depth, &(q_e->max_size));
@@ -2960,17 +2913,10 @@ BOOL samr_io_r_enum_domains(char *desc, SAMR_R_ENUM_DOMAINS * r_u,
prs_uint32("ptr_entries2", ps, depth, &(r_u->ptr_entries2));
prs_uint32("num_entries3", ps, depth, &(r_u->num_entries3));
- if (ps->io)
+ if (UNMARSHALLING(ps))
{
- r_u->sam =
- (SAM_ENTRY *) Realloc(NULL,
- r_u->num_entries2 *
- sizeof(r_u->sam[0]));
- r_u->uni_dom_name =
- (UNISTR2 *) Realloc(NULL,
- r_u->num_entries2 *
- sizeof(r_u->
- uni_dom_name[0]));
+ r_u->sam = g_new(SAM_ENTRY, r_u->num_entries2);
+ r_u->uni_dom_name = g_new(UNISTR2, r_u->num_entries2);
}
if ((r_u->sam == NULL || r_u->uni_dom_name == NULL)
@@ -2978,8 +2924,7 @@ BOOL samr_io_r_enum_domains(char *desc, SAMR_R_ENUM_DOMAINS * r_u,
{
DEBUG(0, ("NULL pointers in SAMR_R_ENUM_DOMAINS\n"));
r_u->num_entries4 = 0;
- r_u->status =
- 0xC0000000 | NT_STATUS_MEMORY_NOT_ALLOCATED;
+ r_u->status = NT_STATUS_MEMORY_NOT_ALLOCATED;
return False;
}
@@ -3046,7 +2991,6 @@ BOOL samr_io_q_enum_dom_groups(char *desc, SAMR_Q_ENUM_DOM_GROUPS * q_e,
prs_align(ps);
smb_io_pol_hnd("pol", &(q_e->pol), ps, depth);
- prs_align(ps);
prs_uint32("start_idx", ps, depth, &(q_e->start_idx));
prs_uint32("max_size ", ps, depth, &(q_e->max_size));
@@ -3114,17 +3058,10 @@ BOOL samr_io_r_enum_dom_groups(char *desc, SAMR_R_ENUM_DOM_GROUPS * r_u,
prs_uint32("ptr_entries2", ps, depth, &(r_u->ptr_entries2));
prs_uint32("num_entries3", ps, depth, &(r_u->num_entries3));
- if (ps->io)
+ if (UNMARSHALLING(ps))
{
- r_u->sam =
- (SAM_ENTRY *) Realloc(NULL,
- r_u->num_entries2 *
- sizeof(r_u->sam[0]));
- r_u->uni_grp_name =
- (UNISTR2 *) Realloc(NULL,
- r_u->num_entries2 *
- sizeof(r_u->
- uni_grp_name[0]));
+ r_u->sam = g_new(SAM_ENTRY, r_u->num_entries2);
+ r_u->uni_grp_name = g_new(UNISTR2, r_u->num_entries2);
}
if ((r_u->sam == NULL || r_u->uni_grp_name == NULL)
@@ -3133,8 +3070,7 @@ BOOL samr_io_r_enum_dom_groups(char *desc, SAMR_R_ENUM_DOM_GROUPS * r_u,
DEBUG(0,
("NULL pointers in SAMR_R_ENUM_DOM_GROUPS\n"));
r_u->num_entries4 = 0;
- r_u->status =
- 0xC0000000 | NT_STATUS_MEMORY_NOT_ALLOCATED;
+ r_u->status = NT_STATUS_MEMORY_NOT_ALLOCATED;
return False;
}
@@ -3197,7 +3133,6 @@ BOOL samr_io_q_enum_dom_aliases(char *desc, SAMR_Q_ENUM_DOM_ALIASES * q_e,
prs_align(ps);
smb_io_pol_hnd("pol", &(q_e->pol), ps, depth);
- prs_align(ps);
prs_uint32("start_idx", ps, depth, &(q_e->start_idx));
prs_uint32("max_size ", ps, depth, &(q_e->max_size));
@@ -3265,17 +3200,10 @@ BOOL samr_io_r_enum_dom_aliases(char *desc, SAMR_R_ENUM_DOM_ALIASES * r_u,
prs_uint32("ptr_entries2", ps, depth, &(r_u->ptr_entries2));
prs_uint32("num_entries3", ps, depth, &(r_u->num_entries3));
- if (ps->io)
+ if (UNMARSHALLING(ps))
{
- r_u->sam =
- (SAM_ENTRY *) Realloc(NULL,
- r_u->num_entries2 *
- sizeof(r_u->sam[0]));
- r_u->uni_grp_name =
- (UNISTR2 *) Realloc(NULL,
- r_u->num_entries2 *
- sizeof(r_u->
- uni_grp_name[0]));
+ r_u->sam = g_new(SAM_ENTRY, r_u->num_entries2);
+ r_u->uni_grp_name = g_new(UNISTR2, r_u->num_entries2);
}
if ((r_u->sam == NULL || r_u->uni_grp_name == NULL)
@@ -3284,8 +3212,7 @@ BOOL samr_io_r_enum_dom_aliases(char *desc, SAMR_R_ENUM_DOM_ALIASES * r_u,
DEBUG(0,
("NULL pointers in SAMR_R_ENUM_DOM_ALIASES\n"));
r_u->num_entries4 = 0;
- r_u->status =
- 0xC0000000 | NT_STATUS_MEMORY_NOT_ALLOCATED;
+ r_u->status = NT_STATUS_MEMORY_NOT_ALLOCATED;
return False;
}
@@ -3422,9 +3349,9 @@ BOOL samr_io_q_query_aliasinfo(char *desc, SAMR_Q_QUERY_ALIASINFO * q_e,
prs_align(ps);
smb_io_pol_hnd("pol", &(q_e->pol), ps, depth);
- prs_align(ps);
prs_uint16("switch_level", ps, depth, &(q_e->switch_level));
+ /* prs_align(ps); */
return True;
}
@@ -3573,7 +3500,6 @@ BOOL samr_io_q_query_useraliases(char *desc, SAMR_Q_QUERY_USERALIASES * q_u,
prs_align(ps);
smb_io_pol_hnd("pol", &(q_u->pol), ps, depth);
- prs_align(ps);
prs_uint32("num_sids1", ps, depth, &(q_u->num_sids1));
prs_uint32("ptr ", ps, depth, &(q_u->ptr));
@@ -3695,7 +3621,7 @@ BOOL samr_io_rids(char *desc, uint32 * num_rids, uint32 ** rid,
if ((*num_rids) != 0)
{
- if (ps->io)
+ if (UNMARSHALLING(ps))
{
/* reading */
(*rid) = g_renew(uint32, (*rid), (*num_rids));
@@ -3760,7 +3686,7 @@ BOOL make_samr_q_open_alias(SAMR_Q_OPEN_ALIAS * q_u, const POLICY_HND * pol,
DEBUG(5, ("make_samr_q_open_alias\n"));
- memcpy(&(q_u->dom_pol), pol, sizeof(q_u->dom_pol));
+ q_u->dom_pol = *pol;
/* example values: 0x0000 0008 */
q_u->unknown_0 = unknown_0;
@@ -3784,7 +3710,7 @@ BOOL samr_io_q_open_alias(char *desc, SAMR_Q_OPEN_ALIAS * q_u,
prs_align(ps);
- smb_io_pol_hnd("dom_pol", &(q_u->dom_pol), ps, depth);
+ smb_io_pol_hnd("domain_pol", &(q_u->dom_pol), ps, depth);
prs_uint32("unknown_0", ps, depth, &(q_u->unknown_0));
prs_uint32("rid_alias", ps, depth, &(q_u->rid_alias));
@@ -3807,7 +3733,6 @@ BOOL samr_io_r_open_alias(char *desc, SAMR_R_OPEN_ALIAS * r_u,
prs_align(ps);
smb_io_pol_hnd("pol", &(r_u->pol), ps, depth);
- prs_align(ps);
prs_uint32("status", ps, depth, &(r_u->status));
@@ -3852,7 +3777,7 @@ BOOL samr_io_q_lookup_rids(char *desc, SAMR_Q_LOOKUP_RIDS * q_u,
prs_debug(ps, depth, desc, "samr_io_q_lookup_rids");
depth++;
- if (ps->io)
+ if (UNMARSHALLING(ps))
{
ZERO_STRUCTP(q_u);
}
@@ -3860,7 +3785,6 @@ BOOL samr_io_q_lookup_rids(char *desc, SAMR_Q_LOOKUP_RIDS * q_u,
prs_align(ps);
smb_io_pol_hnd("pol", &(q_u->pol), ps, depth);
- prs_align(ps);
prs_uint32("num_rids1", ps, depth, &(q_u->num_rids1));
prs_uint32("flags ", ps, depth, &(q_u->flags));
@@ -4077,7 +4001,7 @@ BOOL make_samr_q_delete_alias(SAMR_Q_DELETE_DOM_ALIAS * q_u, POLICY_HND * hnd)
DEBUG(5, ("make_samr_q_delete_alias\n"));
- memcpy(&(q_u->alias_pol), hnd, sizeof(q_u->alias_pol));
+ q_u->alias_pol = *hnd;
return True;
}
@@ -4097,9 +4021,7 @@ BOOL samr_io_q_delete_alias(char *desc, SAMR_Q_DELETE_DOM_ALIAS * q_u,
prs_align(ps);
- smb_io_pol_hnd("alias_pol", &(q_u->alias_pol), ps, depth);
-
- return True;
+ return smb_io_pol_hnd("alias_pol", &(q_u->alias_pol), ps, depth);
}
/*******************************************************************
@@ -4135,7 +4057,7 @@ BOOL make_samr_q_create_dom_alias(SAMR_Q_CREATE_DOM_ALIAS * q_u,
DEBUG(5, ("make_samr_q_create_dom_alias\n"));
- memcpy(&(q_u->dom_pol), hnd, sizeof(q_u->dom_pol));
+ q_u->dom_pol = *hnd;
make_uni_hdr(&(q_u->hdr_acct_desc), acct_len);
make_unistr2(&(q_u->uni_acct_desc), acct_desc, acct_len);
@@ -4145,7 +4067,6 @@ BOOL make_samr_q_create_dom_alias(SAMR_Q_CREATE_DOM_ALIAS * q_u,
return True;
}
-
/*******************************************************************
reads or writes a structure.
********************************************************************/
@@ -4207,13 +4128,12 @@ BOOL make_samr_q_add_aliasmem(SAMR_Q_ADD_ALIASMEM * q_u, POLICY_HND * hnd,
DEBUG(5, ("make_samr_q_add_aliasmem\n"));
- memcpy(&(q_u->alias_pol), hnd, sizeof(q_u->alias_pol));
+ q_u->alias_pol = *hnd;
make_dom_sid2(&q_u->sid, sid);
return True;
}
-
/*******************************************************************
reads or writes a structure.
********************************************************************/
@@ -4265,13 +4185,12 @@ BOOL make_samr_q_del_aliasmem(SAMR_Q_DEL_ALIASMEM * q_u, POLICY_HND * hnd,
DEBUG(5, ("make_samr_q_del_aliasmem\n"));
- memcpy(&(q_u->alias_pol), hnd, sizeof(q_u->alias_pol));
+ q_u->alias_pol = *hnd;
make_dom_sid2(&q_u->sid, sid);
return True;
}
-
/*******************************************************************
reads or writes a structure.
********************************************************************/
@@ -4322,7 +4241,7 @@ BOOL make_samr_q_delete_dom_alias(SAMR_Q_DELETE_DOM_ALIAS * q_c,
DEBUG(5, ("make_samr_q_delete_dom_alias\n"));
- memcpy(&(q_c->alias_pol), hnd, sizeof(q_c->alias_pol));
+ q_c->alias_pol = *hnd;
return True;
}
@@ -4341,9 +4260,7 @@ BOOL samr_io_q_delete_dom_alias(char *desc, SAMR_Q_DELETE_DOM_ALIAS * q_u,
prs_align(ps);
- smb_io_pol_hnd("alias_pol", &(q_u->alias_pol), ps, depth);
-
- return True;
+ return smb_io_pol_hnd("alias_pol", &(q_u->alias_pol), ps, depth);
}
/*******************************************************************
@@ -4393,7 +4310,7 @@ BOOL make_samr_q_query_aliasmem(SAMR_Q_QUERY_ALIASMEM * q_c,
DEBUG(5, ("make_samr_q_query_aliasmem\n"));
- memcpy(&(q_c->alias_pol), hnd, sizeof(q_c->alias_pol));
+ q_c->alias_pol = *hnd;
return True;
}
@@ -4412,9 +4329,7 @@ BOOL samr_io_q_query_aliasmem(char *desc, SAMR_Q_QUERY_ALIASMEM * q_u,
prs_align(ps);
- smb_io_pol_hnd("alias_pol", &(q_u->alias_pol), ps, depth);
-
- return True;
+ return smb_io_pol_hnd("alias_pol", &(q_u->alias_pol), ps, depth);
}
/*******************************************************************
@@ -4510,7 +4425,7 @@ BOOL make_samr_q_lookup_names(SAMR_Q_LOOKUP_NAMES * q_u,
DEBUG(5, ("make_samr_q_lookup_names\n"));
- memcpy(&(q_u->pol), pol, sizeof(*pol));
+ q_u->pol = *pol;
q_u->num_names1 = num_names;
q_u->flags = flags;
@@ -4541,7 +4456,7 @@ BOOL samr_io_q_lookup_names(char *desc, SAMR_Q_LOOKUP_NAMES * q_u,
prs_debug(ps, depth, desc, "samr_io_q_lookup_names");
depth++;
- if (ps->io)
+ if (UNMARSHALLING(ps))
{
ZERO_STRUCTP(q_u);
}
@@ -4549,7 +4464,6 @@ BOOL samr_io_q_lookup_names(char *desc, SAMR_Q_LOOKUP_NAMES * q_u,
prs_align(ps);
smb_io_pol_hnd("pol", &(q_u->pol), ps, depth);
- prs_align(ps);
prs_uint32("num_names1", ps, depth, &(q_u->num_names1));
prs_uint32("flags ", ps, depth, &(q_u->flags));
@@ -4661,7 +4575,7 @@ BOOL samr_io_r_lookup_names(char *desc, SAMR_R_LOOKUP_NAMES * r_u,
prs_debug(ps, depth, desc, "samr_io_r_lookup_names");
depth++;
- if (ps->io)
+ if (UNMARSHALLING(ps))
{
ZERO_STRUCTP(r_u);
}
@@ -4681,7 +4595,7 @@ BOOL samr_io_r_lookup_names(char *desc, SAMR_R_LOOKUP_NAMES * r_u,
return False;
}
- if (ps->io)
+ if (UNMARSHALLING(ps))
r_u->rids = g_new(uint32, r_u->num_rids2);
if (!r_u->rids)
@@ -4711,7 +4625,7 @@ BOOL samr_io_r_lookup_names(char *desc, SAMR_R_LOOKUP_NAMES * r_u,
return False;
}
- if (ps->io)
+ if (UNMARSHALLING(ps))
r_u->types = g_new(uint32, r_u->num_types2);
if (!r_u->types)
@@ -4774,7 +4688,7 @@ BOOL make_samr_q_delete_dom_user(SAMR_Q_DELETE_DOM_USER * q_c,
DEBUG(5, ("make_samr_q_delete_dom_user\n"));
- memcpy(&(q_c->user_pol), hnd, sizeof(q_c->user_pol));
+ q_c->user_pol = *hnd;
return True;
}
@@ -4793,9 +4707,7 @@ BOOL samr_io_q_delete_dom_user(char *desc, SAMR_Q_DELETE_DOM_USER * q_u,
prs_align(ps);
- smb_io_pol_hnd("user_pol", &(q_u->user_pol), ps, depth);
-
- return True;
+ return smb_io_pol_hnd("user_pol", &(q_u->user_pol), ps, depth);
}
/*******************************************************************
@@ -4830,8 +4742,7 @@ BOOL make_samr_q_open_user(SAMR_Q_OPEN_USER * q_u,
DEBUG(5, ("samr_make_samr_q_open_user\n"));
- memcpy(&q_u->domain_pol, pol, sizeof(q_u->domain_pol));
-
+ q_u->domain_pol = *pol;
q_u->access_mask = access_mask;
q_u->user_rid = rid;
@@ -4853,7 +4764,6 @@ BOOL samr_io_q_open_user(char *desc, SAMR_Q_OPEN_USER * q_u, prs_struct * ps,
prs_align(ps);
smb_io_pol_hnd("domain_pol", &(q_u->domain_pol), ps, depth);
- prs_align(ps);
prs_uint32("access_mask", ps, depth, &(q_u->access_mask));
prs_uint32("user_rid ", ps, depth, &(q_u->user_rid));
@@ -4878,13 +4788,13 @@ BOOL samr_io_r_open_user(char *desc, SAMR_R_OPEN_USER * r_u, prs_struct * ps,
prs_align(ps);
smb_io_pol_hnd("user_pol", &(r_u->user_pol), ps, depth);
- prs_align(ps);
prs_uint32("status", ps, depth, &(r_u->status));
return True;
}
+
/*******************************************************************
reads or writes a structure.
********************************************************************/
@@ -4900,7 +4810,7 @@ BOOL make_samr_q_create_user(SAMR_Q_CREATE_USER * q_u,
DEBUG(5, ("samr_make_samr_q_create_user\n"));
- memcpy(&q_u->domain_pol, pol, sizeof(q_u->domain_pol));
+ q_u->domain_pol = *pol;
make_uni_hdr(&(q_u->hdr_name), len_name);
make_unistr2(&(q_u->uni_name), name, len_name);
@@ -4926,7 +4836,6 @@ BOOL samr_io_q_create_user(char *desc, SAMR_Q_CREATE_USER * q_u,
prs_align(ps);
smb_io_pol_hnd("domain_pol", &(q_u->domain_pol), ps, depth);
- prs_align(ps);
smb_io_unihdr("unihdr", &(q_u->hdr_name), ps, depth);
smb_io_unistr2("unistr2", &(q_u->uni_name), q_u->hdr_name.buffer, ps,
@@ -4956,7 +4865,6 @@ BOOL samr_io_r_create_user(char *desc, SAMR_R_CREATE_USER * r_u,
prs_align(ps);
smb_io_pol_hnd("user_pol", &(r_u->user_pol), ps, depth);
- prs_align(ps);
prs_uint32("unknown_0", ps, depth, &(r_u->unknown_0));
prs_uint32("user_rid ", ps, depth, &(r_u->user_rid));
@@ -4965,6 +4873,7 @@ BOOL samr_io_r_create_user(char *desc, SAMR_R_CREATE_USER * r_u,
return True;
}
+
/*******************************************************************
makes a SAMR_Q_QUERY_USERINFO structure.
********************************************************************/
@@ -4976,13 +4885,12 @@ BOOL make_samr_q_query_userinfo(SAMR_Q_QUERY_USERINFO * q_u,
DEBUG(5, ("make_samr_q_query_userinfo\n"));
- memcpy(&(q_u->pol), hnd, sizeof(q_u->pol));
+ q_u->pol = *hnd;
q_u->switch_value = switch_value;
return True;
}
-
/*******************************************************************
reads or writes a structure.
********************************************************************/
@@ -4998,10 +4906,8 @@ BOOL samr_io_q_query_userinfo(char *desc, SAMR_Q_QUERY_USERINFO * q_u,
prs_align(ps);
smb_io_pol_hnd("pol", &(q_u->pol), ps, depth);
- prs_align(ps);
prs_uint16("switch_value", ps, depth, &(q_u->switch_value)); /* 0x0015 or 0x0011 */
-
prs_align(ps);
return True;
@@ -5797,7 +5703,6 @@ BOOL make_sam_user_info21A(SAM_USER_INFO_21 * usr,
return True;
}
-
/*******************************************************************
reads or writes a structure.
********************************************************************/
@@ -6053,15 +5958,10 @@ BOOL samr_io_userinfo_ctr(char *desc, SAM_USERINFO_CTR * ctr, prs_struct * ps,
{
case 0x10:
{
- if (ps->io)
+ if (UNMARSHALLING(ps))
{
/* reading */
- ctr->info.id =
- (SAM_USER_INFO_10 *) Realloc(NULL,
- sizeof
- (*ctr->
- info.
- id10));
+ ctr->info.id10 = g_new(SAM_USER_INFO_10, 1);
}
if (ctr->info.id10 != NULL)
{
@@ -6078,15 +5978,10 @@ BOOL samr_io_userinfo_ctr(char *desc, SAM_USERINFO_CTR * ctr, prs_struct * ps,
}
case 0x11:
{
- if (ps->io)
+ if (UNMARSHALLING(ps))
{
/* reading */
- ctr->info.id =
- (SAM_USER_INFO_11 *) Realloc(NULL,
- sizeof
- (*ctr->
- info.
- id11));
+ ctr->info.id11 = g_new(SAM_USER_INFO_11, 1);
}
if (ctr->info.id11 != NULL)
{
@@ -6103,15 +5998,10 @@ BOOL samr_io_userinfo_ctr(char *desc, SAM_USERINFO_CTR * ctr, prs_struct * ps,
}
case 0x12:
{
- if (ps->io)
+ if (UNMARSHALLING(ps))
{
/* reading */
- ctr->info.id =
- (SAM_USER_INFO_12 *) Realloc(NULL,
- sizeof
- (*ctr->
- info.
- id12));
+ ctr->info.id12 = g_new(SAM_USER_INFO_12, 1);
}
if (ctr->info.id12 != NULL)
{
@@ -6128,15 +6018,10 @@ BOOL samr_io_userinfo_ctr(char *desc, SAM_USERINFO_CTR * ctr, prs_struct * ps,
}
case 21:
{
- if (ps->io)
+ if (UNMARSHALLING(ps))
{
/* reading */
- ctr->info.id =
- (SAM_USER_INFO_21 *) Realloc(NULL,
- sizeof
- (*ctr->
- info.
- id21));
+ ctr->info.id21 = g_new(SAM_USER_INFO_21, 1);
}
if (ctr->info.id21 != NULL)
{
@@ -6153,15 +6038,10 @@ BOOL samr_io_userinfo_ctr(char *desc, SAM_USERINFO_CTR * ctr, prs_struct * ps,
}
case 23:
{
- if (ps->io)
+ if (UNMARSHALLING(ps))
{
/* reading */
- ctr->info.id =
- (SAM_USER_INFO_23 *) Realloc(NULL,
- sizeof
- (*ctr->
- info.
- id23));
+ ctr->info.id23 = g_new(SAM_USER_INFO_23, 1);
}
if (ctr->info.id23 != NULL)
{
@@ -6178,27 +6058,18 @@ BOOL samr_io_userinfo_ctr(char *desc, SAM_USERINFO_CTR * ctr, prs_struct * ps,
}
case 24:
{
- if (ps->io)
+ if (UNMARSHALLING(ps))
{
/* reading */
- ctr->info.id =
- (SAM_USER_INFO_24 *) Realloc(NULL,
- sizeof
- (*ctr->
- info.
- id24));
+ ctr->info.id24 = g_new(SAM_USER_INFO_24, 1);
}
- if (ctr->info.id24 != NULL)
- {
- sam_io_user_info24("", ctr->info.id24, ps,
- depth);
- }
- else
+ if (ctr->info.id24 == NULL)
{
DEBUG(2,
("samr_io_userinfo_ctr: info pointer not initialised\n"));
return False;
}
+ sam_io_user_info24("", ctr->info.id24, ps, depth);
break;
}
default:
@@ -6220,10 +6091,8 @@ frees a structure.
********************************************************************/
void free_samr_userinfo_ctr(SAM_USERINFO_CTR * ctr)
{
- if (ctr->info.id == NULL)
- {
- free(ctr->info.id);
- }
+ if (ctr == NULL) return;
+ safe_free(ctr->info.id);
ctr->info.id = NULL;
}
@@ -6300,7 +6169,7 @@ BOOL make_samr_q_set_userinfo(SAMR_Q_SET_USERINFO * q_u,
DEBUG(5, ("make_samr_q_set_userinfo\n"));
- memcpy(&(q_u->pol), hnd, sizeof(q_u->pol));
+ q_u->pol = *hnd;
q_u->switch_value = switch_value;
if (!cli_get_usr_sesskey(hnd, sess_key))
@@ -6333,7 +6202,6 @@ BOOL samr_io_q_set_userinfo(char *desc, SAMR_Q_SET_USERINFO * q_u,
prs_align(ps);
smb_io_pol_hnd("pol", &(q_u->pol), ps, depth);
- prs_align(ps);
prs_uint16("switch_value", ps, depth, &(q_u->switch_value));
samr_io_userinfo_ctr("ctr", q_u->ctr, ps, depth);
@@ -6352,6 +6220,7 @@ frees a structure.
********************************************************************/
void free_samr_q_set_userinfo(SAMR_Q_SET_USERINFO * q_u)
{
+ if (q_u == NULL) return;
free_samr_userinfo_ctr(q_u->ctr);
}
@@ -6404,7 +6273,7 @@ BOOL make_samr_q_set_userinfo2(SAMR_Q_SET_USERINFO2 * q_u,
DEBUG(5, ("make_samr_q_set_userinfo2\n"));
- memcpy(&(q_u->pol), hnd, sizeof(q_u->pol));
+ q_u->pol = *hnd;
q_u->switch_value = switch_value;
q_u->ctr = ctr;
@@ -6452,9 +6321,8 @@ BOOL samr_io_q_set_userinfo2(char *desc, SAMR_Q_SET_USERINFO2 * q_u,
prs_align(ps);
smb_io_pol_hnd("pol", &(q_u->pol), ps, depth);
- prs_align(ps);
- prs_uint16("switch_value ", ps, depth, &(q_u->switch_value));
+ prs_uint16("switch_value", ps, depth, &(q_u->switch_value));
samr_io_userinfo_ctr("ctr", q_u->ctr, ps, depth);
if (!ps->io)
@@ -6549,7 +6417,6 @@ BOOL samr_io_q_connect(char *desc, SAMR_Q_CONNECT * q_u, prs_struct * ps,
prs_uint32("ptr_srv_name", ps, depth, &(q_u->ptr_srv_name));
smb_io_unistr2("", &(q_u->uni_srv_name), q_u->ptr_srv_name, ps,
depth);
-
prs_align(ps);
prs_uint32("access_mask", ps, depth, &(q_u->access_mask));
@@ -6572,7 +6439,6 @@ BOOL samr_io_r_connect(char *desc, SAMR_R_CONNECT * r_u, prs_struct * ps,
prs_align(ps);
smb_io_pol_hnd("connect_pol", &(r_u->connect_pol), ps, depth);
- prs_align(ps);
prs_uint32("status", ps, depth, &(r_u->status));
@@ -6635,7 +6501,6 @@ BOOL samr_io_r_connect_anon(char *desc, SAMR_R_CONNECT_ANON * r_u,
prs_align(ps);
smb_io_pol_hnd("connect_pol", &(r_u->connect_pol), ps, depth);
- prs_align(ps);
prs_uint32("status", ps, depth, &(r_u->status));
@@ -6659,7 +6524,6 @@ BOOL make_samr_q_get_dom_pwinfo(SAMR_Q_GET_DOM_PWINFO * q_u,
make_uni_hdr(&(q_u->hdr_srv_name), len_srv_name);
make_unistr2(&(q_u->uni_srv_name), srv_name, len_srv_name);
-
return True;
}