summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2006-09-06 18:32:20 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:43:56 -0500
commit995205fc60f87e1a02aa1c6f309db55ae18e908a (patch)
treebf796212b1c95b755ef07b1a91b7e26e45dbbd87
parenta7be2ec7c5eb8bda76eaec0eaff7e1a7b2b39433 (diff)
downloadsamba-995205fc60f87e1a02aa1c6f309db55ae18e908a.tar.gz
samba-995205fc60f87e1a02aa1c6f309db55ae18e908a.tar.bz2
samba-995205fc60f87e1a02aa1c6f309db55ae18e908a.zip
r18188: merge 3.0-libndr branch
(This used to be commit 1115745caed3093c25d6be01ffee21819fb0a675)
-rw-r--r--source3/Makefile.in36
-rw-r--r--source3/TODO4
-rw-r--r--source3/include/rpc_netlogon.h24
-rw-r--r--source3/include/rpc_perfcount.h12
-rw-r--r--source3/include/rpc_samr.h6
-rwxr-xr-xsource3/include/rpc_spoolss.h2
-rw-r--r--source3/include/rpc_unixinfo.h20
-rw-r--r--source3/include/smb.h13
-rw-r--r--source3/lib/time.c1686
-rw-r--r--source3/libads/authdata.c4
-rw-r--r--source3/libmsrpc/libmsrpc.c8
-rw-r--r--source3/libmsrpc/libmsrpc_internal.c12
-rw-r--r--source3/libndr/ndr_basic.c36
-rw-r--r--source3/libndr/ndr_unixinfo.c504
-rw-r--r--source3/libndr/ndr_unixinfo.h41
-rw-r--r--source3/libndr/security.h7
-rw-r--r--source3/libndr/sid.c9
-rw-r--r--source3/libndr/unixinfo.h79
-rw-r--r--source3/nsswitch/winbindd_cache.c8
-rw-r--r--source3/nsswitch/winbindd_pam.c16
-rw-r--r--source3/nsswitch/winbindd_rpc.c4
-rw-r--r--source3/rpc_client/cli_netlogon.c2
-rw-r--r--source3/rpc_client/cli_reg.c2
-rw-r--r--source3/rpc_client/cli_unixinfo.c287
-rw-r--r--source3/rpc_client/cli_unixinfo.h9
-rw-r--r--source3/rpc_parse/parse_misc.c28
-rw-r--r--source3/rpc_parse/parse_net.c5
-rw-r--r--source3/rpc_parse/parse_samr.c27
-rw-r--r--source3/rpc_parse/parse_spoolss.c4
-rw-r--r--source3/rpc_parse/parse_unixinfo.c10
-rw-r--r--source3/rpc_server/srv_samr_util.c36
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c3
-rw-r--r--source3/rpc_server/srv_unixinfo_nt.c27
-rw-r--r--source3/rpcclient/cmd_lsarpc.c4
-rw-r--r--source3/rpcclient/cmd_netlogon.c5
-rw-r--r--source3/rpcclient/cmd_samr.c56
-rw-r--r--source3/rpcclient/cmd_unixinfo.c32
-rwxr-xr-xsource3/script/tests/test_posix_s3.sh1
-rw-r--r--source3/torture/msgtest.c17
-rw-r--r--source3/utils/net_rpc.c2
-rw-r--r--source3/utils/net_rpc_samsync.c59
41 files changed, 1765 insertions, 1382 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in
index c7406a759f..60adf713d6 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -212,6 +212,8 @@ SOCKET_WRAPPER_OBJ = lib/socket_wrapper.o
LIBNDR_OBJ = libndr/ndr_basic.o libndr/ndr.o libndr/ndr_misc.o \
libndr/ndr_sec_helper.o libndr/ndr_string.o libndr/sid.o
+LIBNDR_GEN_OBJ = libndr/ndr_unixinfo.o
+
RPC_PARSE_OBJ0 = rpc_parse/parse_prs.o rpc_parse/parse_misc.o
TALLOC_OBJ = lib/talloc.o
@@ -292,7 +294,9 @@ LIBMSRPC_OBJ = rpc_client/cli_lsarpc.o rpc_client/cli_samr.o \
rpc_client/cli_spoolss.o rpc_client/cli_spoolss_notify.o \
rpc_client/cli_ds.o rpc_client/cli_echo.o \
rpc_client/cli_shutdown.o rpc_client/cli_svcctl.o \
- rpc_client/cli_unixinfo.o
+ rpc_client/ndr.o
+
+LIBMSRPC_GEN_OBJ = rpc_client/cli_unixinfo.o $(LIBNDR_GEN_OBJ) $(LIBNDR_OBJ)
REGOBJS_OBJ = registry/reg_objects.o
@@ -307,7 +311,7 @@ RPC_NETLOG_OBJ = rpc_server/srv_netlog.o rpc_server/srv_netlog_nt.o
RPC_SAMR_OBJ = rpc_server/srv_samr.o rpc_server/srv_samr_nt.o \
rpc_server/srv_samr_util.o
-RPC_UNIXINFO_OBJ = rpc_server/srv_unixinfo.o rpc_server/srv_unixinfo_nt.o
+RPC_UNIXINFO_OBJ = rpc_server/srv_unixinfo.o rpc_server/srv_unixinfo_nt.o rpc_parse/parse_unixinfo.o
REGFIO_OBJ = registry/regfio.o
RPC_REG_OBJ = rpc_server/srv_reg.o rpc_server/srv_reg_nt.o $(REGFIO_OBJ)
@@ -348,7 +352,7 @@ RPC_PARSE_OBJ = rpc_parse/parse_lsa.o rpc_parse/parse_net.o \
rpc_parse/parse_wks.o rpc_parse/parse_ds.o \
rpc_parse/parse_spoolss.o rpc_parse/parse_dfs.o \
rpc_parse/parse_echo.o rpc_parse/parse_shutdown.o \
- rpc_parse/parse_svcctl.o rpc_parse/parse_unixinfo.o \
+ rpc_parse/parse_svcctl.o \
rpc_parse/parse_eventlog.o rpc_parse/parse_buffer.o \
rpc_parse/parse_ntsvcs.o $(REGOBJS_OBJ)
@@ -454,7 +458,7 @@ SMBD_OBJ_BASE = $(PARAM_OBJ) $(SMBD_OBJ_SRV) $(LIBSMB_OBJ) \
$(LOCKING_OBJ) $(PASSDB_OBJ) $(PRINTING_OBJ) $(PROFILE_OBJ) \
$(LIB_OBJ) $(PRINTBACKEND_OBJ) $(OPLOCK_OBJ) \
$(NOTIFY_OBJ) $(GROUPDB_OBJ) $(AUTH_OBJ) \
- $(LIBMSRPC_OBJ) \
+ $(LIBMSRPC_OBJ) $(LIBMSRPC_GEN_OBJ) \
$(LIBADS_OBJ) $(KRBCLIENT_OBJ) $(LIBADS_SERVER_OBJ) \
$(REGISTRY_OBJ) $(POPT_LIB_OBJ) \
$(BUILDOPT_OBJ) $(SMBLDAP_OBJ)
@@ -490,7 +494,7 @@ SWAT_OBJ1 = web/cgi.o web/diagnose.o web/startstop.o web/statuspage.o \
SWAT_OBJ = $(SWAT_OBJ1) $(PARAM_OBJ) $(PRINTING_OBJ) $(LIBSMB_OBJ) \
$(LOCKING_OBJ) $(PASSDB_OBJ) $(SECRETS_OBJ) $(KRBCLIENT_OBJ) \
$(LIB_NONSMBD_OBJ) $(GROUPDB_OBJ) $(PLAINTEXT_AUTH_OBJ) \
- $(POPT_LIB_OBJ) $(SMBLDAP_OBJ) $(RPC_PARSE_OBJ) $(LIBMSRPC_OBJ) \
+ $(POPT_LIB_OBJ) $(SMBLDAP_OBJ) $(RPC_PARSE_OBJ) $(LIBMSRPC_GEN_OBJ) $(LIBMSRPC_OBJ) \
$(PASSCHANGE_OBJ)
STATUS_OBJ = utils/status.o utils/status_profile.o \
@@ -519,7 +523,7 @@ TESTPARM_OBJ = utils/testparm.o \
SMBPASSWD_OBJ = utils/smbpasswd.o utils/passwd_util.o $(PASSCHANGE_OBJ) \
$(PARAM_OBJ) $(SECRETS_OBJ) $(LIBSMB_OBJ) $(PASSDB_OBJ) \
$(GROUPDB_OBJ) $(LIB_NONSMBD_OBJ) $(KRBCLIENT_OBJ) \
- $(POPT_LIB_OBJ) $(SMBLDAP_OBJ) $(RPC_PARSE_OBJ) $(LIBMSRPC_OBJ)
+ $(POPT_LIB_OBJ) $(SMBLDAP_OBJ) $(RPC_PARSE_OBJ) $(LIBMSRPC_GEN_OBJ) $(LIBMSRPC_OBJ)
PDBEDIT_OBJ = utils/pdbedit.o utils/passwd_util.o $(PARAM_OBJ) $(PASSDB_OBJ) \
$(LIBSAMBA_OBJ) $(LIB_NONSMBD_OBJ) $(GROUPDB_OBJ) \
@@ -538,7 +542,7 @@ RPCCLIENT_OBJ1 = rpcclient/rpcclient.o rpcclient/cmd_lsarpc.o \
RPCCLIENT_OBJ = $(RPCCLIENT_OBJ1) \
$(PARAM_OBJ) $(LIBSMB_OBJ) $(LIB_NONSMBD_OBJ) \
- $(RPC_PARSE_OBJ) $(PASSDB_OBJ) $(LIBMSRPC_OBJ) \
+ $(RPC_PARSE_OBJ) $(PASSDB_OBJ) $(LIBMSRPC_GEN_OBJ) $(LIBMSRPC_OBJ) \
$(READLINE_OBJ) $(GROUPDB_OBJ) $(KRBCLIENT_OBJ) \
$(LIBADS_OBJ) $(SECRETS_OBJ) $(POPT_LIB_OBJ) \
$(SMBLDAP_OBJ) $(DCUTIL_OBJ)
@@ -550,7 +554,7 @@ LIBSMBCLIENT_OBJ = libsmb/libsmbclient.o libsmb/libsmb_compat.o \
libsmb/libsmb_cache.o \
$(PARAM_OBJ) $(LIB_NONSMBD_OBJ) \
$(LIBSMB_OBJ) $(KRBCLIENT_OBJ) \
- $(LIBMSRPC_OBJ) $(RPC_PARSE_OBJ) \
+ $(LIBMSRPC_OBJ) $(LIBMSRPC_GEN_OBJ) $(RPC_PARSE_OBJ) \
$(SECRETS_OBJ) $(PASSDB_OBJ) $(SMBLDAP_OBJ) $(GROUPDB_OBJ)
CAC_OBJ = $(LIBSMBCLIENT_OBJ) \
@@ -567,7 +571,7 @@ LIBSMBSHAREMODES_OBJ = libsmb/smb_share_modes.o $(TDB_BASE_OBJ)
LIBBIGBALLOFMUD_MAJOR = 0
LIBBIGBALLOFMUD_OBJ = $(PARAM_OBJ) $(LIB_NONSMBD_OBJ) $(SECRETS_OBJ) \
- $(LIBSMB_OBJ) $(LIBMSRPC_OBJ) $(RPC_PARSE_OBJ) $(PASSDB_OBJ) \
+ $(LIBSMB_OBJ) $(LIBMSRPC_OBJ) $(LIBMSRPC_GEN_OBJ) $(RPC_PARSE_OBJ) $(PASSDB_OBJ) \
$(GROUPDB_OBJ) $(KRBCLIENT_OBJ) $(SMBLDAP_OBJ)
LIBBIGBALLOFMUD_PICOBJS = $(LIBBIGBALLOFMUD_OBJ:.o=.@PICSUFFIX@)
@@ -596,8 +600,8 @@ NET_OBJ1 = utils/net.o utils/net_ads.o utils/net_domain.o utils/net_help.o \
NET_OBJ = $(NET_OBJ1) $(PARAM_OBJ) $(SECRETS_OBJ) $(LIBSMB_OBJ) \
$(RPC_PARSE_OBJ) $(PASSDB_OBJ) $(GROUPDB_OBJ) \
- $(KRBCLIENT_OBJ) $(LIB_NONSMBD_OBJ) $(LIBADDNS_OBJ0)\
- $(LIBMSRPC_OBJ) $(IDMAP_OBJ) \
+ $(KRBCLIENT_OBJ) $(LIB_NONSMBD_OBJ) $(LIBADDNS_OBJ0) \
+ $(LIBMSRPC_OBJ) $(LIBMSRPC_GEN_OBJ) $(IDMAP_OBJ) \
$(LIBADS_OBJ) $(LIBADS_SERVER_OBJ) $(POPT_LIB_OBJ) \
$(SMBLDAP_OBJ) $(DCUTIL_OBJ) $(SERVER_MUTEX_OBJ) \
$(AFS_OBJ) $(AFS_SETTOKEN_OBJ) $(REGFIO_OBJ) $(READLINE_OBJ) \
@@ -654,13 +658,13 @@ LOCKTEST2_OBJ = torture/locktest2.o $(PARAM_OBJ) $(LOCKING_OBJ) $(LIBSMB_OBJ) \
SMBCACLS_OBJ = utils/smbcacls.o $(PARAM_OBJ) $(LIBSMB_OBJ) \
$(KRBCLIENT_OBJ) $(LIB_NONSMBD_OBJ) $(RPC_PARSE_OBJ) \
- $(PASSDB_OBJ) $(GROUPDB_OBJ) $(LIBMSRPC_OBJ) $(SECRETS_OBJ) \
+ $(PASSDB_OBJ) $(GROUPDB_OBJ) $(LIBMSRPC_OBJ) $(LIBMSRPC_GEN_OBJ) $(SECRETS_OBJ) \
$(POPT_LIB_OBJ) $(DCUTIL_OBJ) $(LIBADS_OBJ) $(SMBLDAP_OBJ)
SMBCQUOTAS_OBJ = utils/smbcquotas.o $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) \
$(PARAM_OBJ) \
$(LIB_NONSMBD_OBJ) $(RPC_PARSE_OBJ) \
- $(LIBMSRPC_OBJ) $(SECRETS_OBJ) $(POPT_LIB_OBJ) \
+ $(LIBMSRPC_OBJ) $(LIBMSRPC_GEN_OBJ) $(SECRETS_OBJ) $(POPT_LIB_OBJ) \
$(PASSDB_OBJ) $(SMBLDAP_OBJ) $(GROUPDB_OBJ)
EVTLOGADM_OBJ0 = utils/eventlogadm.o
@@ -694,7 +698,7 @@ DEBUG2HTML_OBJ = utils/debug2html.o utils/debugparse.o
SMBFILTER_OBJ = utils/smbfilter.o $(PARAM_OBJ) $(LIBSMB_OBJ) $(SECRETS_OBJ) \
$(LIB_NONSMBD_OBJ) $(KRBCLIENT_OBJ)
-PROTO_OBJ = $(SMBD_OBJ_MAIN) \
+PROTO_OBJ = $(SMBD_OBJ_MAIN) $(LIBNDR_OBJ) \
$(SMBD_OBJ_SRV) $(NMBD_OBJ1) $(SWAT_OBJ1) $(LIB_OBJ) $(LIBSMB_OBJ) \
$(SMBTORTURE_OBJ1) $(RPCCLIENT_OBJ1) \
$(LIBMSRPC_OBJ) @SMBWRAP_OBJS@ \
@@ -747,7 +751,7 @@ WINBINDD_OBJ1 = \
WINBINDD_OBJ = \
$(WINBINDD_OBJ1) $(PASSDB_OBJ) $(GROUPDB_OBJ) \
$(PARAM_OBJ) $(LIB_NONSMBD_OBJ) \
- $(LIBSMB_OBJ) $(LIBMSRPC_OBJ) $(RPC_PARSE_OBJ) \
+ $(LIBSMB_OBJ) $(LIBMSRPC_OBJ) $(LIBMSRPC_GEN_OBJ) $(RPC_PARSE_OBJ) \
$(PROFILE_OBJ) $(SLCACHE_OBJ) $(SMBLDAP_OBJ) \
$(SECRETS_OBJ) $(LIBADS_OBJ) $(KRBCLIENT_OBJ) $(POPT_LIB_OBJ) \
$(DCUTIL_OBJ) $(IDMAP_OBJ) \
@@ -1576,7 +1580,7 @@ installpammodules: $(PAM_MODULES)
# Python extensions
PYTHON_OBJS = $(PARAM_OBJ) $(LIB_NONSMBD_OBJ) $(LIBSMB_OBJ) $(RPC_PARSE_OBJ) \
- $(LIBMSRPC_OBJ) $(PASSDB_OBJ) $(GROUPDB_OBJ) \
+ $(LIBMSRPC_OBJ) $(LIBMSRPC_GEN_OBJ) $(PASSDB_OBJ) $(GROUPDB_OBJ) \
$(SECRETS_OBJ) $(KRBCLIENT_OBJ) $(SMBLDAP_OBJ)
PYTHON_PICOBJS = $(PYTHON_OBJS:.o=.@PICSUFFIX@)
diff --git a/source3/TODO b/source3/TODO
new file mode 100644
index 0000000000..b5f98ab216
--- /dev/null
+++ b/source3/TODO
@@ -0,0 +1,4 @@
+- Properly map Samba4's dom_sid to Samba3's DOM_SID
+- Allow building IDL files from within the Samba3 tree
+- Autogenerate correct headers so generated files don't have to
+ be edited for Samba3
diff --git a/source3/include/rpc_netlogon.h b/source3/include/rpc_netlogon.h
index f80dc3121d..6ccff623fb 100644
--- a/source3/include/rpc_netlogon.h
+++ b/source3/include/rpc_netlogon.h
@@ -661,8 +661,8 @@ typedef struct account_lockout_string {
uint32 offset;
uint32 length;
/* uint16 *bindata; */
- UINT64_S lockout_duration;
- UINT64_S reset_count;
+ uint64 lockout_duration;
+ uint64 reset_count;
uint32 bad_attempt_lockout;
uint32 dummy;
} LOCKOUT_STRING;
@@ -679,12 +679,12 @@ typedef struct sam_domain_info_info {
UNIHDR hdr_dom_name;
UNIHDR hdr_oem_info;
- UINT64_S force_logoff;
+ uint64 force_logoff;
uint16 min_pwd_len;
uint16 pwd_history_len;
- UINT64_S max_pwd_age;
- UINT64_S min_pwd_age;
- UINT64_S dom_mod_count;
+ uint64 max_pwd_age;
+ uint64 min_pwd_age;
+ uint64 dom_mod_count;
NTTIME creation_time;
uint32 security_information;
@@ -848,7 +848,7 @@ typedef struct sam_alias_mem_info_info {
/* SAM_DELTA_POLICY (0x0D) */
typedef struct {
uint32 max_log_size; /* 0x5000 */
- UINT64_S audit_retention_period; /* 0 */
+ uint64 audit_retention_period; /* 0 */
uint32 auditing_mode; /* 0 */
uint32 num_events;
uint32 ptr_events;
@@ -860,7 +860,7 @@ typedef struct {
uint32 min_workset_size; /* 0x00010000 */
uint32 max_workset_size; /* 0x0f000000 */
uint32 page_file_limit; /* 0 */
- UINT64_S time_limit; /* 0 */
+ uint64 time_limit; /* 0 */
NTTIME modify_time; /* 0x3c*/
NTTIME create_time; /* a7080110 */
BUFHDR2 hdr_sec_desc;
@@ -907,7 +907,7 @@ typedef struct {
uint32 min_workset_size; /* 0x00010000 */
uint32 max_workset_size; /* 0x0f000000 */
uint32 page_file_limit; /* 0 */
- UINT64_S time_limit; /* 0 */
+ uint64 time_limit; /* 0 */
uint32 system_flags; /* 1 */
BUFHDR2 hdr_sec_desc;
@@ -961,7 +961,7 @@ typedef struct {
typedef struct {
uint32 seqnum;
uint32 dom_mod_count_ptr;
- UINT64_S dom_mod_count; /* domain mod count at last sync */
+ uint64 dom_mod_count; /* domain mod count at last sync */
} SAM_DELTA_MOD_COUNT;
typedef union sam_delta_ctr_info {
@@ -1003,7 +1003,7 @@ typedef struct net_q_sam_deltas_info {
DOM_CRED ret_creds;
uint32 database_id;
- UINT64_S dom_mod_count; /* domain mod count at last sync */
+ uint64 dom_mod_count; /* domain mod count at last sync */
uint32 max_size; /* preferred maximum length */
} NET_Q_SAM_DELTAS;
@@ -1012,7 +1012,7 @@ typedef struct net_q_sam_deltas_info {
typedef struct net_r_sam_deltas_info {
DOM_CRED srv_creds;
- UINT64_S dom_mod_count; /* new domain mod count */
+ uint64 dom_mod_count; /* new domain mod count */
uint32 ptr_deltas;
uint32 num_deltas;
diff --git a/source3/include/rpc_perfcount.h b/source3/include/rpc_perfcount.h
index 0e3a6eb018..dcf4e0d164 100644
--- a/source3/include/rpc_perfcount.h
+++ b/source3/include/rpc_perfcount.h
@@ -59,8 +59,8 @@ typedef struct perf_object_type
uint32 DefaultCounter;
uint32 NumInstances;
uint32 CodePage;
- UINT64_S PerfTime;
- UINT64_S PerfFreq;
+ uint64 PerfTime;
+ uint64 PerfFreq;
PERF_COUNTER_DEFINITION *counters;
PERF_INSTANCE_DEFINITION *instances;
PERF_COUNTER_BLOCK counter_data;
@@ -88,13 +88,13 @@ typedef struct perf_data_block
PerfTime, and having it there will make my offset math much easier. */
uint32 Padding;
/* Now when I'm marshalling this, I'll need to call prs_align_uint64()
- before I start encodint the UINT64_S structs */
+ before I start encodint the uint64 structs */
/* clock rate * seconds uptime */
- UINT64_S PerfTime;
+ uint64 PerfTime;
/* The clock rate of the CPU */
- UINT64_S PerfFreq;
+ uint64 PerfFreq;
/* used for high-res timers -- for now PerfTime * 10e7 */
- UINT64_S PerfTime100nSec;
+ uint64 PerfTime100nSec;
uint32 SystemNameLength;
uint32 SystemNameOffset;
/* The SystemName, in unicode, terminated */
diff --git a/source3/include/rpc_samr.h b/source3/include/rpc_samr.h
index ed4e51837f..fc861b9e7a 100644
--- a/source3/include/rpc_samr.h
+++ b/source3/include/rpc_samr.h
@@ -553,7 +553,7 @@ typedef struct sam_unknown_info_2_inf
pointer is referring to
*/
- UINT64_S seq_num;
+ uint64 seq_num;
uint32 unknown_4; /* 0x0000 0001 */
uint32 server_role;
@@ -605,7 +605,7 @@ typedef struct sam_unknown_info_7_info
typedef struct sam_unknown_info_8_info
{
- UINT64_S seq_num;
+ uint64 seq_num;
NTTIME domain_create_time;
} SAM_UNK_INFO_8;
@@ -626,7 +626,7 @@ typedef struct sam_unknown_info_12_inf
typedef struct sam_unknown_info_13_info
{
- UINT64_S seq_num;
+ uint64 seq_num;
NTTIME domain_create_time;
uint32 unknown1;
uint32 unknown2;
diff --git a/source3/include/rpc_spoolss.h b/source3/include/rpc_spoolss.h
index 681dcd73d4..ecc50bd8aa 100755
--- a/source3/include/rpc_spoolss.h
+++ b/source3/include/rpc_spoolss.h
@@ -1556,7 +1556,7 @@ typedef struct {
uint32 previousnames_len;
uint32 previousnames_ptr;
NTTIME driverdate;
- UINT64_S driverversion;
+ uint64 driverversion;
uint32 dummy4;
uint32 mfgname_ptr;
uint32 oemurl_ptr;
diff --git a/source3/include/rpc_unixinfo.h b/source3/include/rpc_unixinfo.h
index f2f4382fc4..913196b7c9 100644
--- a/source3/include/rpc_unixinfo.h
+++ b/source3/include/rpc_unixinfo.h
@@ -34,12 +34,12 @@ typedef struct unixinfo_q_sid_to_uid {
} UNIXINFO_Q_SID_TO_UID;
typedef struct unixinfo_r_sid_to_uid {
- UINT64_S uid;
+ uint64 uid;
NTSTATUS status;
} UNIXINFO_R_SID_TO_UID;
typedef struct unixinfo_q_uid_to_sid {
- UINT64_S uid;
+ uint64 uid;
} UNIXINFO_Q_UID_TO_SID;
typedef struct unixinfo_r_uid_to_sid {
@@ -53,12 +53,12 @@ typedef struct unixinfo_q_sid_to_gid {
} UNIXINFO_Q_SID_TO_GID;
typedef struct unixinfo_r_sid_to_gid {
- UINT64_S gid;
+ uint64 gid;
NTSTATUS status;
} UNIXINFO_R_SID_TO_GID;
typedef struct unixinfo_q_gid_to_sid {
- UINT64_S gid;
+ uint64 gid;
} UNIXINFO_Q_GID_TO_SID;
typedef struct unixinfo_r_gid_to_sid {
@@ -69,7 +69,7 @@ typedef struct unixinfo_r_gid_to_sid {
typedef struct unixinfo_q_getpwuid {
uint32 count;
- UINT64_S *uid;
+ uint64 *uid;
} UNIXINFO_Q_GETPWUID;
struct unixinfo_getpwuid {
@@ -123,12 +123,12 @@ typedef struct unixinfo_q_sid_to_uid {
} UNIXINFO_Q_SID_TO_UID;
typedef struct unixinfo_r_sid_to_uid {
- UINT64_S uid;
+ uint64 uid;
NTSTATUS status;
} UNIXINFO_R_SID_TO_UID;
typedef struct unixinfo_q_uid_to_sid {
- UINT64_S uid;
+ uint64 uid;
} UNIXINFO_Q_UID_TO_SID;
typedef struct unixinfo_r_uid_to_sid {
@@ -142,12 +142,12 @@ typedef struct unixinfo_q_sid_to_gid {
} UNIXINFO_Q_SID_TO_GID;
typedef struct unixinfo_r_sid_to_gid {
- UINT64_S gid;
+ uint64 gid;
NTSTATUS status;
} UNIXINFO_R_SID_TO_GID;
typedef struct unixinfo_q_gid_to_sid {
- UINT64_S gid;
+ uint64 gid;
} UNIXINFO_Q_GID_TO_SID;
typedef struct unixinfo_r_gid_to_sid {
@@ -157,7 +157,7 @@ typedef struct unixinfo_r_gid_to_sid {
} UNIXINFO_R_GID_TO_SID;
typedef struct unixinfo_q_getpwuid {
- UINT64_S uid;
+ uint64 uid;
} UNIXINFO_Q_GETPWUID;
typedef struct unixinfo_r_getpwuid {
diff --git a/source3/include/smb.h b/source3/include/smb.h
index 6f1e51b1a6..741b4a9d53 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -213,14 +213,8 @@ typedef smb_ucs2_t wfstring[FSTRING_LEN];
#define PI_NTSVCS 14
#define PI_MAX_PIPES 15
-typedef struct uint64_s
-{
- uint32 low;
- uint32 high;
-} UINT64_S;
-
/* 64 bit time (100usec) since ????? - cifs6.txt, section 3.5, page 30 */
-typedef UINT64_S NTTIME;
+typedef uint64_t NTTIME;
/* Allowable account control bits */
@@ -280,7 +274,7 @@ enum SID_NAME_USE {
*
* @sa http://msdn.microsoft.com/library/default.asp?url=/library/en-us/security/accctrl_38yn.asp
**/
-typedef struct sid_info {
+typedef struct dom_sid {
uint8 sid_rev_num; /**< SID revision number */
uint8 num_auths; /**< Number of sub-authorities */
uint8 id_auth[6]; /**< Identifier Authority */
@@ -293,6 +287,9 @@ typedef struct sid_info {
uint32 sub_auths[MAXSUBAUTHS];
} DOM_SID;
+#include "libndr/misc.h"
+#include "libndr/security.h"
+
struct lsa_dom_info {
BOOL valid;
DOM_SID sid;
diff --git a/source3/lib/time.c b/source3/lib/time.c
index 0fb35bd977..715c1a1bcc 100644
--- a/source3/lib/time.c
+++ b/source3/lib/time.c
@@ -1,8 +1,10 @@
/*
Unix SMB/CIFS implementation.
time handling functions
- Copyright (C) Andrew Tridgell 1992-1998
+
+ Copyright (C) Andrew Tridgell 1992-2004
Copyright (C) Stefan (metze) Metzmacher 2002
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
@@ -20,16 +22,11 @@
#include "includes.h"
-/*
- This stuff was largely rewritten by Paul Eggert <eggert@twinsun.com>
- in May 1996
- */
-
-int extra_time_offset = 0;
+/**
+ * @file
+ * @brief time handling functions
+ */
-#ifndef CHAR_BIT
-#define CHAR_BIT 8
-#endif
#ifndef TIME_T_MIN
#define TIME_T_MIN ((time_t)0 < (time_t) -1 ? (time_t) 0 \
@@ -39,19 +36,17 @@ int extra_time_offset = 0;
#define TIME_T_MAX (~ (time_t) 0 - TIME_T_MIN)
#endif
-/*******************************************************************
+/**
External access to time_t_min and time_t_max.
-********************************************************************/
-
+**/
time_t get_time_t_max(void)
{
return TIME_T_MAX;
}
-/*******************************************************************
- A gettimeofday wrapper.
-********************************************************************/
-
+/**
+a gettimeofday wrapper
+**/
void GetTimeOfDay(struct timeval *tval)
{
#ifdef HAVE_GETTIMEOFDAY_TZ
@@ -61,126 +56,7 @@ void GetTimeOfDay(struct timeval *tval)
#endif
}
-#define TM_YEAR_BASE 1900
-
-/*******************************************************************
- Yield the difference between *A and *B, in seconds, ignoring leap seconds.
-********************************************************************/
-
-static int tm_diff(struct tm *a, struct tm *b)
-{
- int ay = a->tm_year + (TM_YEAR_BASE - 1);
- int by = b->tm_year + (TM_YEAR_BASE - 1);
- int intervening_leap_days = (ay/4 - by/4) - (ay/100 - by/100) + (ay/400 - by/400);
- int years = ay - by;
- int days = 365*years + intervening_leap_days + (a->tm_yday - b->tm_yday);
- int hours = 24*days + (a->tm_hour - b->tm_hour);
- int minutes = 60*hours + (a->tm_min - b->tm_min);
- int seconds = 60*minutes + (a->tm_sec - b->tm_sec);
-
- return seconds;
-}
-
-/*******************************************************************
- Return the UTC offset in seconds west of UTC, or 0 if it cannot be determined.
-******************************************************************/
-
-int get_time_zone(time_t t)
-{
- struct tm *tm = gmtime(&t);
- struct tm tm_utc;
-
- if (!tm) {
- return 0;
- }
- tm_utc = *tm;
- tm = localtime(&t);
- if (!tm) {
- return 0;
- }
- return tm_diff(&tm_utc,tm) + 60*extra_time_offset;
-}
-
-/*******************************************************************
- Accessor function for the server time zone offset.
- set_server_zone_offset() must have been called first.
-******************************************************************/
-
-static int server_zone_offset;
-
-int get_server_zone_offset(void)
-{
- return server_zone_offset;
-}
-
-/*******************************************************************
- Initialize the server time zone offset. Called when a client connects.
-******************************************************************/
-
-int set_server_zone_offset(time_t t)
-{
- server_zone_offset = get_time_zone(t);
- return server_zone_offset;
-}
-
-/*******************************************************************
- Re-read the smb serverzone value.
-******************************************************************/
-
-static struct timeval start_time_hires;
-
-void TimeInit(void)
-{
- set_server_zone_offset(time(NULL));
-
- DEBUG(4,("TimeInit: Serverzone is %d\n", server_zone_offset));
-
- /* Save the start time of this process. */
- if (start_time_hires.tv_sec == 0 && start_time_hires.tv_usec == 0) {
- GetTimeOfDay(&start_time_hires);
- }
-}
-
-/**********************************************************************
- Return a timeval struct of the uptime of this process. As TimeInit is
- done before a daemon fork then this is the start time from the parent
- daemon start. JRA.
-***********************************************************************/
-
-void get_process_uptime(struct timeval *ret_time)
-{
- struct timeval time_now_hires;
-
- GetTimeOfDay(&time_now_hires);
- ret_time->tv_sec = time_now_hires.tv_sec - start_time_hires.tv_sec;
- if (time_now_hires.tv_usec < start_time_hires.tv_usec) {
- ret_time->tv_sec -= 1;
- ret_time->tv_usec = 1000000 + (time_now_hires.tv_usec - start_time_hires.tv_usec);
- } else {
- ret_time->tv_usec = time_now_hires.tv_usec - start_time_hires.tv_usec;
- }
-}
-
-#if 0
-/****************************************************************************
- Return the UTC offset in seconds west of UTC, adjusted for extra time offset.
-**************************************************************************/
-
-int TimeDiff(time_t t)
-{
- return get_time_zone(t);
-}
-#endif
-
-time_t convert_timespec_to_time_t(struct timespec ts)
-{
- /* 1 ns == 1,000,000,000 - one thousand millionths of a second.
- increment if it's greater than 500 millionth of a second. */
- if (ts.tv_nsec > 500000000) {
- return ts.tv_sec + 1;
- }
- return ts.tv_sec;
-}
+#define TIME_FIXUP_CONSTANT 11644473600LL
struct timespec convert_time_t_to_timespec(time_t t)
{
@@ -190,8 +66,6 @@ struct timespec convert_time_t_to_timespec(time_t t)
return ts;
}
-#ifdef uint64
-
#if (SIZEOF_LONG == 8)
#define TIME_FIXUP_CONSTANT_INT 11644473600L
#elif (SIZEOF_LONG_LONG == 8)
@@ -210,259 +84,9 @@ struct timespec convert_time_t_to_timespec(time_t t)
Returns GMT.
****************************************************************************/
-/* Large integer version. */
-static struct timespec nt_time_to_unix_timespec(NTTIME *nt)
-{
- uint64 d;
- struct timespec ret;
-
- if ((nt->high == 0 && nt->low == 0 )||
- (nt->high == 0xffffffff && nt->low == 0xffffffff)) {
- ret.tv_sec = 0;
- ret.tv_nsec = 0;
- return ret;
- }
-
- d = (((uint64)nt->high) << 32 ) + ((uint64)nt->low);
- /* d is now in 100ns units, since jan 1st 1601".
- Save off the ns fraction. */
-
- ret.tv_nsec = (long) ((d % 100) * 100);
-
- /* Convert to seconds */
- d /= 1000*1000*10;
-
- /* Now adjust by 369 years to make the secs since 1970 */
- d -= TIME_FIXUP_CONSTANT_INT;
-
- if (((time_t)d) <= TIME_T_MIN) {
- ret.tv_sec = TIME_T_MIN;
- ret.tv_nsec = 0;
- return ret;
- }
-
- if ((d >= (uint64)TIME_T_MAX)) {
- ret.tv_sec = TIME_T_MAX;
- ret.tv_nsec = 0;
- return ret;
- }
-
- ret.tv_sec = (time_t)d;
- return ret;
-}
-
-/****************************************************************************
- Convert a NTTIME structure to a time_t.
- It's originally in "100ns units".
-
- This is an absolute version of the one above.
- By absolute I mean, it doesn't adjust from 1/1/1601 to 1/1/1970
- if the NTTIME was 5 seconds, the time_t is 5 seconds. JFM
-****************************************************************************/
-
-time_t nt_time_to_unix_abs(const NTTIME *nt)
-{
- uint64 d;
- NTTIME neg_nt;
-
- if (nt->high == 0) {
- return (time_t)0;
- }
-
- if (nt->high==0x80000000 && nt->low==0) {
- return (time_t)-1;
- }
-
- /* reverse the time */
- /* it's a negative value, turn it to positive */
- neg_nt.high=~nt->high;
- neg_nt.low=~nt->low;
-
- d = (((uint64)neg_nt.high) << 32 ) + ((uint64)neg_nt.low);
-
- d += 1000*1000*10/2;
- d /= 1000*1000*10;
-
- if (!(TIME_T_MIN <= ((time_t)d) && ((time_t)d) <= TIME_T_MAX)) {
- return (time_t)0;
- }
-
- return (time_t)d;
-}
-
-/****************************************************************************
- Put a 8 byte filetime from a struct timespec. Uses GMT.
-****************************************************************************/
-
-void unix_timespec_to_nt_time(NTTIME *nt, struct timespec ts)
-{
- uint64 d;
-
- if (ts.tv_sec ==0 && ts.tv_nsec == 0) {
- nt->low = 0;
- nt->high = 0;
- return;
- }
- if (ts.tv_sec == TIME_T_MAX) {
- nt->low = 0xffffffff;
- nt->high = 0x7fffffff;
- return;
- }
- if (ts.tv_sec == (time_t)-1) {
- nt->low = 0xffffffff;
- nt->high = 0xffffffff;
- return;
- }
-
- d = ts.tv_sec;
- d += TIME_FIXUP_CONSTANT_INT;
- d *= 1000*1000*10;
- /* d is now in 100ns units. */
- d += (ts.tv_nsec / 100);
-
- nt->low = (uint32)(d & 0xFFFFFFFF);
- nt->high = (uint32)(d >> 32 );
-}
-
-#else
-
-/* No 64-bit datatype. Use double float. */
-#define TIME_FIXUP_CONSTANT_DOUBLE (369.0*365.25*24*60*60-(3.0*24*60*60+6.0*60*60))
-
-/* Floating point double versions. */
-static struct timespec nt_time_to_unix_timespec(NTTIME *nt)
+time_t nt_time_to_unix(NTTIME nt)
{
- double d;
- struct timespec ret;
-
- if ((nt->high == 0 && nt->low == 0 )||
- (nt->high == 0xffffffff && nt->low == 0xffffffff)) {
- ret.tv_sec = 0;
- ret.tv_nsec = 0;
- return ret;
- }
-
- d = ((double)nt->high)*4.0*(double)(1<<30);
- d += (nt->low&0xFFF00000);
- d *= 1.0e-7;
-
- /* now adjust by 369 years to make the secs since 1970 */
- d -= TIME_FIXUP_CONSTANT_DOUBLE;
-
- if (d <= TIME_T_MIN) {
- ret.tv_sec = TIME_T_MIN;
- ret.tv_nsec = 0;
- return ret;
- }
-
- if (d >= TIME_T_MAX) {
- ret.tv_sec = TIME_T_MAX;
- ret.tv_nsec = 0;
- return ret;
- }
-
- ret.tv_sec = (time_t)d;
- ret.tv_nsec = (long) ((d - (double)ret.tv_sec)*1.0e9);
- return ret;
-}
-
-/****************************************************************************
- Convert a NTTIME structure to a time_t.
- It's originally in "100ns units".
-
- This is an absolute version of the one above.
- By absolute I mean, it doesn't adjust from 1/1/1601 to 1/1/1970
- if the NTTIME was 5 seconds, the time_t is 5 seconds. JFM
-****************************************************************************/
-
-time_t nt_time_to_unix_abs(const NTTIME *nt)
-{
- double d;
- time_t ret;
- NTTIME neg_nt;
-
- if (nt->high == 0) {
- return (time_t)0;
- }
-
- if (nt->high==0x80000000 && nt->low==0) {
- return (time_t)-1;
- }
-
- /* reverse the time */
- /* it's a negative value, turn it to positive */
- neg_nt.high=~nt->high;
- neg_nt.low=~nt->low;
-
- d = ((double)neg_nt.high)*4.0*(double)(1<<30);
- d += (neg_nt.low&0xFFF00000);
- d *= 1.0e-7;
-
- if (!(TIME_T_MIN <= d && d <= TIME_T_MAX)) {
- return (time_t)0;
- }
-
- ret = (time_t)(d+0.5);
- return ret;
-}
-
-/****************************************************************************
- Put a 8 byte filetime from a struct timespec. Uses GMT.
-****************************************************************************/
-
-void unix_timespec_to_nt_time(NTTIME *nt, struct timespec ts)
-{
- double d;
-
- if (ts.tv_sec ==0 && ts.tv_nsec == 0) {
- nt->low = 0;
- nt->high = 0;
- return;
- }
- if (ts.tv_sec == TIME_T_MAX) {
- nt->low = 0xffffffff;
- nt->high = 0x7fffffff;
- return;
- }
- if (ts.tv_sec == (time_t)-1) {
- nt->low = 0xffffffff;
- nt->high = 0xffffffff;
- return;
- }
-
- d = (double)(ts.tv_sec);
- d += TIME_FIXUP_CONSTANT_DOUBLE;
- d *= 1.0e7;
- d += ((double)ts.tv_nsec / 100.0);
-
- nt->high = (uint32)(d * (1.0/(4.0*(double)(1<<30))));
- nt->low = (uint32)(d - ((double)nt->high)*4.0*(double)(1<<30));
-}
-#endif
-
-time_t nt_time_to_unix(NTTIME *nt)
-{
- return convert_timespec_to_time_t(nt_time_to_unix_timespec(nt));
-}
-
-/****************************************************************************
- Interprets an nt time into a unix struct timespec.
- Differs from nt_time_to_unix in that an 8 byte value of 0xffffffffffffffff
- will be returned as (time_t)-1, whereas nt_time_to_unix returns 0 in this case.
-****************************************************************************/
-
-struct timespec interpret_long_date(char *p)
-{
- NTTIME nt;
- nt.low = IVAL(p,0);
- nt.high = IVAL(p,4);
- if (nt.low == 0xFFFFFFFF && nt.high == 0xFFFFFFFF) {
- struct timespec ret;
- ret.tv_sec = (time_t)-1;
- ret.tv_nsec = 0;
- return ret;
- }
- return nt_time_to_unix_timespec(&nt);
+ return convert_timespec_to_time_t(nt_time_to_unix_timespec(&nt));
}
/****************************************************************************
@@ -471,125 +95,81 @@ struct timespec interpret_long_date(char *p)
void unix_to_nt_time(NTTIME *nt, time_t t)
{
- struct timespec ts;
- ts.tv_sec = t;
- ts.tv_nsec = 0;
- unix_timespec_to_nt_time(nt, ts);
-}
-
-/****************************************************************************
- Convert a time_t to a NTTIME structure
-
- This is an absolute version of the one above.
- By absolute I mean, it doesn't adjust from 1/1/1970 to 1/1/1601
- If the nttime_t was 5 seconds, the NTTIME is 5 seconds. JFM
-****************************************************************************/
-
-void unix_to_nt_time_abs(NTTIME *nt, time_t t)
-{
- double d;
-
- if (t==0) {
- nt->low = 0;
- nt->high = 0;
- return;
- }
+ uint64_t t2;
- if (t == TIME_T_MAX) {
- nt->low = 0xffffffff;
- nt->high = 0x7fffffff;
- return;
- }
-
if (t == (time_t)-1) {
- /* that's what NT uses for infinite */
- nt->low = 0x0;
- nt->high = 0x80000000;
+ *nt = (NTTIME)-1LL;
+ return;
+ }
+ if (t == 0) {
+ *nt = 0;
return;
}
- d = (double)(t);
- d *= 1.0e7;
-
- nt->high = (uint32)(d * (1.0/(4.0*(double)(1<<30))));
- nt->low = (uint32)(d - ((double)nt->high)*4.0*(double)(1<<30));
+ t2 = t;
+ t2 += TIME_FIXUP_CONSTANT;
+ t2 *= 1000*1000*10;
- /* convert to a negative value */
- nt->high=~nt->high;
- nt->low=~nt->low;
+ *nt = t2;
}
-/****************************************************************************
- Take a Unix time and convert to an NTTIME structure and place in buffer
- pointed to by p.
-****************************************************************************/
-
-void put_long_date_timespec(char *p, struct timespec ts)
-{
- NTTIME nt;
- unix_timespec_to_nt_time(&nt, ts);
- SIVAL(p, 0, nt.low);
- SIVAL(p, 4, nt.high);
-}
-void put_long_date(char *p, time_t t)
+/**
+check if it's a null unix time
+**/
+BOOL null_time(time_t t)
{
- struct timespec ts;
- ts.tv_sec = t;
- ts.tv_nsec = 0;
- put_long_date_timespec(p, ts);
+ return t == 0 ||
+ t == (time_t)0xFFFFFFFF ||
+ t == (time_t)-1;
}
-/****************************************************************************
- Check if it's a null mtime.
-****************************************************************************/
-BOOL null_mtime(time_t mtime)
+/**
+check if it's a null NTTIME
+**/
+BOOL null_nttime(NTTIME t)
{
- if (mtime == 0 || mtime == (time_t)0xFFFFFFFF || mtime == (time_t)-1)
- return(True);
- return(False);
+ return t == 0 || t == (NTTIME)-1;
}
/*******************************************************************
- Create a 16 bit dos packed date.
+ create a 16 bit dos packed date
********************************************************************/
-
-static uint16 make_dos_date1(struct tm *t)
+static uint16_t make_dos_date1(struct tm *t)
{
- uint16 ret=0;
- ret = (((unsigned)(t->tm_mon+1)) >> 3) | ((t->tm_year-80) << 1);
+ uint16_t ret=0;
+ ret = (((unsigned int)(t->tm_mon+1)) >> 3) | ((t->tm_year-80) << 1);
ret = ((ret&0xFF)<<8) | (t->tm_mday | (((t->tm_mon+1) & 0x7) << 5));
- return(ret);
+ return ret;
}
/*******************************************************************
- Create a 16 bit dos packed time.
+ create a 16 bit dos packed time
********************************************************************/
-
-static uint16 make_dos_time1(struct tm *t)
+static uint16_t make_dos_time1(struct tm *t)
{
- uint16 ret=0;
- ret = ((((unsigned)t->tm_min >> 3)&0x7) | (((unsigned)t->tm_hour) << 3));
+ uint16_t ret=0;
+ ret = ((((unsigned int)t->tm_min >> 3)&0x7) | (((unsigned int)t->tm_hour) << 3));
ret = ((ret&0xFF)<<8) | ((t->tm_sec/2) | ((t->tm_min & 0x7) << 5));
- return(ret);
+ return ret;
}
/*******************************************************************
- Create a 32 bit dos packed date/time from some parameters.
- This takes a GMT time and returns a packed localtime structure.
+ create a 32 bit dos packed date/time from some parameters
+ This takes a GMT time and returns a packed localtime structure
********************************************************************/
-
-static uint32 make_dos_date(time_t unixdate, int zone_offset)
+static uint32_t make_dos_date(time_t unixdate, int zone_offset)
{
struct tm *t;
- uint32 ret=0;
+ uint32_t ret=0;
if (unixdate == 0) {
return 0;
}
unixdate -= zone_offset;
+
t = gmtime(&unixdate);
if (!t) {
return 0xFFFFFFFF;
@@ -598,53 +178,50 @@ static uint32 make_dos_date(time_t unixdate, int zone_offset)
ret = make_dos_date1(t);
ret = ((ret&0xFFFF)<<16) | make_dos_time1(t);
- return(ret);
+ return ret;
}
-/*******************************************************************
- Put a dos date into a buffer (time/date format).
- This takes GMT time and puts local time in the buffer.
-********************************************************************/
-
-static void put_dos_date(char *buf,int offset,time_t unixdate, int zone_offset)
+/**
+put a dos date into a buffer (time/date format)
+This takes GMT time and puts local time in the buffer
+**/
+void push_dos_date(uint8_t *buf, int offset, time_t unixdate, int zone_offset)
{
- uint32 x = make_dos_date(unixdate, zone_offset);
+ uint32_t x = make_dos_date(unixdate, zone_offset);
SIVAL(buf,offset,x);
}
-/*******************************************************************
- Put a dos date into a buffer (date/time format).
- This takes GMT time and puts local time in the buffer.
-********************************************************************/
-
-static void put_dos_date2(char *buf,int offset,time_t unixdate, int zone_offset)
+/**
+put a dos date into a buffer (date/time format)
+This takes GMT time and puts local time in the buffer
+**/
+void push_dos_date2(uint8_t *buf,int offset,time_t unixdate, int zone_offset)
{
- uint32 x = make_dos_date(unixdate, zone_offset);
+ uint32_t x;
+ x = make_dos_date(unixdate, zone_offset);
x = ((x&0xFFFF)<<16) | ((x&0xFFFF0000)>>16);
SIVAL(buf,offset,x);
}
-/*******************************************************************
- Put a dos 32 bit "unix like" date into a buffer. This routine takes
- GMT and converts it to LOCAL time before putting it (most SMBs assume
- localtime for this sort of date)
-********************************************************************/
-
-static void put_dos_date3(char *buf,int offset,time_t unixdate, int zone_offset)
+/**
+put a dos 32 bit "unix like" date into a buffer. This routine takes
+GMT and converts it to LOCAL time before putting it (most SMBs assume
+localtime for this sort of date)
+**/
+void push_dos_date3(uint8_t *buf,int offset,time_t unixdate, int zone_offset)
{
- if (!null_mtime(unixdate)) {
+ if (!null_time(unixdate)) {
unixdate -= zone_offset;
}
SIVAL(buf,offset,unixdate);
}
/*******************************************************************
- Interpret a 32 bit dos packed date/time to some parameters.
+ interpret a 32 bit dos packed date/time to some parameters
********************************************************************/
-
-static void interpret_dos_date(uint32 date,int *year,int *month,int *day,int *hour,int *minute,int *second)
+static void interpret_dos_date(uint32_t date,int *year,int *month,int *day,int *hour,int *minute,int *second)
{
- uint32 p0,p1,p2,p3;
+ uint32_t p0,p1,p2,p3;
p0=date&0xFF; p1=((date&0xFF00)>>8)&0xFF;
p2=((date&0xFF0000)>>16)&0xFF; p3=((date&0xFF000000)>>24)&0xFF;
@@ -657,154 +234,407 @@ static void interpret_dos_date(uint32 date,int *year,int *month,int *day,int *ho
*year = ((p3>>1)&0xFF) + 80;
}
-/*******************************************************************
- Create a unix date (int GMT) from a dos date (which is actually in
- localtime).
-********************************************************************/
-
-static time_t make_unix_date(void *date_ptr, int zone_offset)
+/**
+ create a unix date (int GMT) from a dos date (which is actually in
+ localtime)
+**/
+time_t pull_dos_date(const uint8_t *date_ptr, int zone_offset)
{
- uint32 dos_date=0;
+ uint32_t dos_date=0;
struct tm t;
time_t ret;
dos_date = IVAL(date_ptr,0);
- if (dos_date == 0) {
- return 0;
- }
+ if (dos_date == 0) return (time_t)0;
interpret_dos_date(dos_date,&t.tm_year,&t.tm_mon,
- &t.tm_mday,&t.tm_hour,&t.tm_min,&t.tm_sec);
+ &t.tm_mday,&t.tm_hour,&t.tm_min,&t.tm_sec);
t.tm_isdst = -1;
ret = timegm(&t);
ret += zone_offset;
- return(ret);
+ return ret;
}
-/*******************************************************************
- Like make_unix_date() but the words are reversed.
-********************************************************************/
-
-static time_t make_unix_date2(void *date_ptr, int zone_offset)
+/**
+like make_unix_date() but the words are reversed
+**/
+time_t pull_dos_date2(const uint8_t *date_ptr, int zone_offset)
{
- uint32 x,x2;
+ uint32_t x,x2;
x = IVAL(date_ptr,0);
x2 = ((x&0xFFFF)<<16) | ((x&0xFFFF0000)>>16);
SIVAL(&x,0,x2);
- return(make_unix_date((void *)&x, zone_offset));
+ return pull_dos_date((void *)&x, zone_offset);
}
-/*******************************************************************
- Create a unix GMT date from a dos date in 32 bit "unix like" format
- these generally arrive as localtimes, with corresponding DST.
-******************************************************************/
-
-static time_t make_unix_date3(void *date_ptr, int zone_offset)
+/**
+ create a unix GMT date from a dos date in 32 bit "unix like" format
+ these generally arrive as localtimes, with corresponding DST
+**/
+time_t pull_dos_date3(const uint8_t *date_ptr, int zone_offset)
{
time_t t = (time_t)IVAL(date_ptr,0);
- if (!null_mtime(t)) {
+ if (!null_time(t)) {
t += zone_offset;
}
- return(t);
+ return t;
}
/***************************************************************************
- Server versions of the above functions.
+ Return a HTTP/1.0 time string.
***************************************************************************/
-void srv_put_dos_date(char *buf,int offset,time_t unixdate)
+char *http_timestring(time_t t)
{
- put_dos_date(buf, offset, unixdate, server_zone_offset);
+ static fstring buf;
+ struct tm *tm = localtime(&t);
+
+ if (!tm) {
+ slprintf(buf,sizeof(buf)-1,"%ld seconds since the Epoch",(long)t);
+ } else {
+#ifndef HAVE_STRFTIME
+ const char *asct = asctime(tm);
+ fstrcpy(buf, asct ? asct : "unknown");
+ }
+ if(buf[strlen(buf)-1] == '\n') {
+ buf[strlen(buf)-1] = 0;
+#else /* !HAVE_STRFTIME */
+ strftime(buf, sizeof(buf)-1, "%a, %d %b %Y %H:%M:%S %Z", tm);
+#endif /* !HAVE_STRFTIME */
+ }
+ return buf;
}
-void srv_put_dos_date2(char *buf,int offset, time_t unixdate)
+
+/**
+ Return the date and time as a string
+**/
+char *timestring(TALLOC_CTX *mem_ctx, time_t t)
{
- put_dos_date2(buf, offset, unixdate, server_zone_offset);
+ char *TimeBuf;
+ char tempTime[80];
+ struct tm *tm;
+
+ tm = localtime(&t);
+ if (!tm) {
+ return talloc_asprintf(mem_ctx,
+ "%ld seconds since the Epoch",
+ (long)t);
+ }
+
+#ifdef HAVE_STRFTIME
+ /* some versions of gcc complain about using %c. This is a bug
+ in the gcc warning, not a bug in this code. See a recent
+ strftime() manual page for details.
+ */
+ strftime(tempTime,sizeof(tempTime)-1,"%c %Z",tm);
+ TimeBuf = talloc_strdup(mem_ctx, tempTime);
+#else
+ TimeBuf = talloc_strdup(mem_ctx, asctime(tm));
+#endif
+
+ return TimeBuf;
}
-void srv_put_dos_date3(char *buf,int offset,time_t unixdate)
+/**
+ return a talloced string representing a NTTIME for human consumption
+*/
+const char *nt_time_string(TALLOC_CTX *mem_ctx, NTTIME nt)
{
- put_dos_date3(buf, offset, unixdate, server_zone_offset);
+ time_t t;
+ if (nt == 0) {
+ return "NTTIME(0)";
+ }
+ t = nt_time_to_unix(nt);
+ return timestring(mem_ctx, t);
}
-time_t srv_make_unix_date(void *date_ptr)
+
+/**
+ parse a nttime as a large integer in a string and return a NTTIME
+*/
+NTTIME nttime_from_string(const char *s)
{
- return make_unix_date(date_ptr, server_zone_offset);
+ return strtoull(s, NULL, 0);
}
-time_t srv_make_unix_date2(void *date_ptr)
+/**
+ return (tv1 - tv2) in microseconds
+*/
+int64_t usec_time_diff(struct timeval *tv1, struct timeval *tv2)
{
- return make_unix_date2(date_ptr, server_zone_offset);
+ int64_t sec_diff = tv1->tv_sec - tv2->tv_sec;
+ return (sec_diff * 1000000) + (int64_t)(tv1->tv_usec - tv2->tv_usec);
}
-time_t srv_make_unix_date3(void *date_ptr)
+
+/**
+ return a zero timeval
+*/
+struct timeval timeval_zero(void)
{
- return make_unix_date3(date_ptr, server_zone_offset);
+ struct timeval tv;
+ tv.tv_sec = 0;
+ tv.tv_usec = 0;
+ return tv;
}
-/***************************************************************************
- Client versions of the above functions.
-***************************************************************************/
+/**
+ return True if a timeval is zero
+*/
+BOOL timeval_is_zero(const struct timeval *tv)
+{
+ return tv->tv_sec == 0 && tv->tv_usec == 0;
+}
-void cli_put_dos_date(struct cli_state *cli, char *buf, int offset, time_t unixdate)
+/**
+ return a timeval for the current time
+*/
+struct timeval timeval_current(void)
{
- put_dos_date(buf, offset, unixdate, cli->serverzone);
+ struct timeval tv;
+ GetTimeOfDay(&tv);
+ return tv;
}
-void cli_put_dos_date2(struct cli_state *cli, char *buf, int offset, time_t unixdate)
+/**
+ return a timeval struct with the given elements
+*/
+struct timeval timeval_set(uint32_t secs, uint32_t usecs)
{
- put_dos_date2(buf, offset, unixdate, cli->serverzone);
+ struct timeval tv;
+ tv.tv_sec = secs;
+ tv.tv_usec = usecs;
+ return tv;
}
-void cli_put_dos_date3(struct cli_state *cli, char *buf, int offset, time_t unixdate)
+
+/**
+ return a timeval ofs microseconds after tv
+*/
+struct timeval timeval_add(const struct timeval *tv,
+ uint32_t secs, uint32_t usecs)
{
- put_dos_date3(buf, offset, unixdate, cli->serverzone);
+ struct timeval tv2 = *tv;
+ const unsigned int million = 1000000;
+ tv2.tv_sec += secs;
+ tv2.tv_usec += usecs;
+ tv2.tv_sec += tv2.tv_usec / million;
+ tv2.tv_usec = tv2.tv_usec % million;
+ return tv2;
}
-time_t cli_make_unix_date(struct cli_state *cli, void *date_ptr)
+/**
+ return the sum of two timeval structures
+*/
+struct timeval timeval_sum(const struct timeval *tv1,
+ const struct timeval *tv2)
{
- return make_unix_date(date_ptr, cli->serverzone);
+ return timeval_add(tv1, tv2->tv_sec, tv2->tv_usec);
}
-time_t cli_make_unix_date2(struct cli_state *cli, void *date_ptr)
+/**
+ return a timeval secs/usecs into the future
+*/
+struct timeval timeval_current_ofs(uint32_t secs, uint32_t usecs)
{
- return make_unix_date2(date_ptr, cli->serverzone);
+ struct timeval tv = timeval_current();
+ return timeval_add(&tv, secs, usecs);
}
-time_t cli_make_unix_date3(struct cli_state *cli, void *date_ptr)
+/**
+ compare two timeval structures.
+ Return -1 if tv1 < tv2
+ Return 0 if tv1 == tv2
+ Return 1 if tv1 > tv2
+*/
+int timeval_compare(const struct timeval *tv1, const struct timeval *tv2)
{
- return make_unix_date3(date_ptr, cli->serverzone);
+ if (tv1->tv_sec > tv2->tv_sec) return 1;
+ if (tv1->tv_sec < tv2->tv_sec) return -1;
+ if (tv1->tv_usec > tv2->tv_usec) return 1;
+ if (tv1->tv_usec < tv2->tv_usec) return -1;
+ return 0;
}
-/***************************************************************************
- Return a HTTP/1.0 time string.
-***************************************************************************/
+/**
+ return True if a timer is in the past
+*/
+BOOL timeval_expired(const struct timeval *tv)
+{
+ struct timeval tv2 = timeval_current();
+ if (tv2.tv_sec > tv->tv_sec) return True;
+ if (tv2.tv_sec < tv->tv_sec) return False;
+ return (tv2.tv_usec >= tv->tv_usec);
+}
-char *http_timestring(time_t t)
+/**
+ return the number of seconds elapsed between two times
+*/
+double timeval_elapsed2(const struct timeval *tv1, const struct timeval *tv2)
{
- static fstring buf;
- struct tm *tm = localtime(&t);
+ return (tv2->tv_sec - tv1->tv_sec) +
+ (tv2->tv_usec - tv1->tv_usec)*1.0e-6;
+}
- if (!tm) {
- slprintf(buf,sizeof(buf)-1,"%ld seconds since the Epoch",(long)t);
+/**
+ return the number of seconds elapsed since a given time
+*/
+double timeval_elapsed(const struct timeval *tv)
+{
+ struct timeval tv2 = timeval_current();
+ return timeval_elapsed2(tv, &tv2);
+}
+
+/**
+ return the lesser of two timevals
+*/
+struct timeval timeval_min(const struct timeval *tv1,
+ const struct timeval *tv2)
+{
+ if (tv1->tv_sec < tv2->tv_sec) return *tv1;
+ if (tv1->tv_sec > tv2->tv_sec) return *tv2;
+ if (tv1->tv_usec < tv2->tv_usec) return *tv1;
+ return *tv2;
+}
+
+/**
+ return the greater of two timevals
+*/
+struct timeval timeval_max(const struct timeval *tv1,
+ const struct timeval *tv2)
+{
+ if (tv1->tv_sec > tv2->tv_sec) return *tv1;
+ if (tv1->tv_sec < tv2->tv_sec) return *tv2;
+ if (tv1->tv_usec > tv2->tv_usec) return *tv1;
+ return *tv2;
+}
+
+/**
+ return the difference between two timevals as a timeval
+ if tv1 comes after tv2, then return a zero timeval
+ (this is *tv2 - *tv1)
+*/
+struct timeval timeval_until(const struct timeval *tv1,
+ const struct timeval *tv2)
+{
+ struct timeval t;
+ if (timeval_compare(tv1, tv2) >= 0) {
+ return timeval_zero();
+ }
+ t.tv_sec = tv2->tv_sec - tv1->tv_sec;
+ if (tv1->tv_usec > tv2->tv_usec) {
+ t.tv_sec--;
+ t.tv_usec = 1000000 - (tv1->tv_usec - tv2->tv_usec);
} else {
-#ifndef HAVE_STRFTIME
- const char *asct = asctime(tm);
- fstrcpy(buf, asct ? asct : "unknown");
+ t.tv_usec = tv2->tv_usec - tv1->tv_usec;
}
- if(buf[strlen(buf)-1] == '\n') {
- buf[strlen(buf)-1] = 0;
-#else /* !HAVE_STRFTIME */
- strftime(buf, sizeof(buf)-1, "%a, %d %b %Y %H:%M:%S %Z", tm);
-#endif /* !HAVE_STRFTIME */
+ return t;
+}
+
+
+/**
+ convert a timeval to a NTTIME
+*/
+NTTIME timeval_to_nttime(const struct timeval *tv)
+{
+ return 10*(tv->tv_usec +
+ ((TIME_FIXUP_CONSTANT + (uint64_t)tv->tv_sec) * 1000000));
+}
+
+/*******************************************************************
+yield the difference between *A and *B, in seconds, ignoring leap seconds
+********************************************************************/
+static int tm_diff(struct tm *a, struct tm *b)
+{
+ int ay = a->tm_year + (1900 - 1);
+ int by = b->tm_year + (1900 - 1);
+ int intervening_leap_days =
+ (ay/4 - by/4) - (ay/100 - by/100) + (ay/400 - by/400);
+ int years = ay - by;
+ int days = 365*years + intervening_leap_days + (a->tm_yday - b->tm_yday);
+ int hours = 24*days + (a->tm_hour - b->tm_hour);
+ int minutes = 60*hours + (a->tm_min - b->tm_min);
+ int seconds = 60*minutes + (a->tm_sec - b->tm_sec);
+
+ return seconds;
+}
+
+int extra_time_offset=0;
+
+/**
+ return the UTC offset in seconds west of UTC, or 0 if it cannot be determined
+ */
+int get_time_zone(time_t t)
+{
+ struct tm *tm = gmtime(&t);
+ struct tm tm_utc;
+ if (!tm)
+ return 0;
+ tm_utc = *tm;
+ tm = localtime(&t);
+ if (!tm)
+ return 0;
+ return tm_diff(&tm_utc,tm)+60*extra_time_offset;
+}
+
+/****************************************************************************
+ Check if NTTIME is 0.
+****************************************************************************/
+
+BOOL nt_time_is_zero(const NTTIME *nt)
+{
+ return (*nt == 0);
+}
+
+/****************************************************************************
+ Convert ASN.1 GeneralizedTime string to unix-time.
+ Returns 0 on failure; Currently ignores timezone.
+****************************************************************************/
+
+time_t generalized_to_unix_time(const char *str)
+{
+ struct tm tm;
+
+ ZERO_STRUCT(tm);
+
+ if (sscanf(str, "%4d%2d%2d%2d%2d%2d",
+ &tm.tm_year, &tm.tm_mon, &tm.tm_mday,
+ &tm.tm_hour, &tm.tm_min, &tm.tm_sec) != 6) {
+ return 0;
}
- return buf;
+ tm.tm_year -= 1900;
+ tm.tm_mon -= 1;
+
+ return timegm(&tm);
+}
+
+/*******************************************************************
+ Accessor function for the server time zone offset.
+ set_server_zone_offset() must have been called first.
+******************************************************************/
+
+static int server_zone_offset;
+
+int get_server_zone_offset(void)
+{
+ return server_zone_offset;
+}
+
+/*******************************************************************
+ Initialize the server time zone offset. Called when a client connects.
+******************************************************************/
+
+int set_server_zone_offset(time_t t)
+{
+ server_zone_offset = get_time_zone(t);
+ return server_zone_offset;
}
/****************************************************************************
@@ -866,276 +696,118 @@ char *current_timestring(BOOL hires)
return(TimeBuf);
}
-/****************************************************************************
- Return the best approximation to a 'create time' under UNIX from a stat
- structure.
-****************************************************************************/
-
-time_t get_create_time(SMB_STRUCT_STAT *st,BOOL fake_dirs)
-{
- time_t ret, ret1;
-
- if(S_ISDIR(st->st_mode) && fake_dirs) {
- return (time_t)315493200L; /* 1/1/1980 */
- }
-
- ret = MIN(st->st_ctime, st->st_mtime);
- ret1 = MIN(ret, st->st_atime);
- if(ret1 != (time_t)0) {
- return ret1;
- }
-
- /*
- * One of ctime, mtime or atime was zero (probably atime).
- * Just return MIN(ctime, mtime).
- */
- return ret;
-}
+/*******************************************************************
+ Put a dos date into a buffer (time/date format).
+ This takes GMT time and puts local time in the buffer.
+********************************************************************/
-struct timespec get_create_timespec(SMB_STRUCT_STAT *st,BOOL fake_dirs)
+static void put_dos_date(char *buf,int offset,time_t unixdate, int zone_offset)
{
- struct timespec ts;
- ts.tv_sec = get_create_time(st, fake_dirs);
- ts.tv_nsec = 0;
- return ts;
+ uint32 x = make_dos_date(unixdate, zone_offset);
+ SIVAL(buf,offset,x);
}
-/****************************************************************************
- Initialise an NTTIME to -1, which means "unknown" or "don't expire".
-****************************************************************************/
-
-void init_nt_time(NTTIME *nt)
-{
- nt->high = 0x7FFFFFFF;
- nt->low = 0xFFFFFFFF;
-}
+/*******************************************************************
+ Put a dos date into a buffer (date/time format).
+ This takes GMT time and puts local time in the buffer.
+********************************************************************/
-BOOL nt_time_is_set(const NTTIME *nt)
+static void put_dos_date2(char *buf,int offset,time_t unixdate, int zone_offset)
{
- if ((nt->high == 0x7FFFFFFF) && (nt->low == 0xFFFFFFFF)) {
- return False;
- }
-
- if ((nt->high == 0x80000000) && (nt->low == 0)) {
- return False;
- }
-
- return True;
+ uint32 x = make_dos_date(unixdate, zone_offset);
+ x = ((x&0xFFFF)<<16) | ((x&0xFFFF0000)>>16);
+ SIVAL(buf,offset,x);
}
-/****************************************************************************
- Check if NTTIME is 0.
-****************************************************************************/
+/*******************************************************************
+ Put a dos 32 bit "unix like" date into a buffer. This routine takes
+ GMT and converts it to LOCAL time before putting it (most SMBs assume
+ localtime for this sort of date)
+********************************************************************/
-BOOL nt_time_is_zero(const NTTIME *nt)
+static void put_dos_date3(char *buf,int offset,time_t unixdate, int zone_offset)
{
- if(nt->high==0) {
- return True;
+ if (!null_mtime(unixdate)) {
+ unixdate -= zone_offset;
}
- return False;
-}
-
-/****************************************************************************
- Check if two NTTIMEs are the same.
-****************************************************************************/
-
-BOOL nt_time_equals(const NTTIME *nt1, const NTTIME *nt2)
-{
- return (nt1->high == nt2->high && nt1->low == nt2->low);
-}
-
-/****************************************************************************
- Return a timeval difference in usec.
-****************************************************************************/
-
-SMB_BIG_INT usec_time_diff(const struct timeval *larget, const struct timeval *smallt)
-{
- SMB_BIG_INT sec_diff = larget->tv_sec - smallt->tv_sec;
- return (sec_diff * 1000000) + (SMB_BIG_INT)(larget->tv_usec - smallt->tv_usec);
+ SIVAL(buf,offset,unixdate);
}
-/****************************************************************************
- Return a timeval struct with the given elements.
-****************************************************************************/
-struct timeval timeval_set(uint32_t secs, uint32_t usecs)
-{
- struct timeval tv;
- tv.tv_sec = secs;
- tv.tv_usec = usecs;
- return tv;
-}
-
-/****************************************************************************
- Return a zero timeval.
-****************************************************************************/
+/***************************************************************************
+ Server versions of the above functions.
+***************************************************************************/
-struct timeval timeval_zero(void)
+void srv_put_dos_date(char *buf,int offset,time_t unixdate)
{
- return timeval_set(0,0);
+ put_dos_date(buf, offset, unixdate, server_zone_offset);
}
-/****************************************************************************
- Return True if a timeval is zero.
-****************************************************************************/
-
-BOOL timeval_is_zero(const struct timeval *tv)
+void srv_put_dos_date2(char *buf,int offset, time_t unixdate)
{
- return tv->tv_sec == 0 && tv->tv_usec == 0;
+ put_dos_date2(buf, offset, unixdate, server_zone_offset);
}
-/****************************************************************************
- Return a timeval for the current time.
-****************************************************************************/
-
-struct timeval timeval_current(void)
+void srv_put_dos_date3(char *buf,int offset,time_t unixdate)
{
- struct timeval tv;
- GetTimeOfDay(&tv);
- return tv;
+ put_dos_date3(buf, offset, unixdate, server_zone_offset);
}
/****************************************************************************
- Return a timeval ofs microseconds after tv.
+ Take a Unix time and convert to an NTTIME structure and place in buffer
+ pointed to by p.
****************************************************************************/
-struct timeval timeval_add(const struct timeval *tv,
- uint32_t secs, uint32_t usecs)
+void put_long_date_timespec(char *p, struct timespec ts)
{
- struct timeval tv2 = *tv;
- tv2.tv_sec += secs;
- tv2.tv_usec += usecs;
- tv2.tv_sec += tv2.tv_usec / 1000000;
- tv2.tv_usec = tv2.tv_usec % 1000000;
- return tv2;
+ NTTIME nt;
+ unix_timespec_to_nt_time(&nt, ts);
+ SIVAL(p, 0, nt & 0xFFFFFFFF);
+ SIVAL(p, 4, nt >> 32);
}
-/****************************************************************************
- Return the sum of two timeval structures.
-****************************************************************************/
-
-struct timeval timeval_sum(const struct timeval *tv1,
- const struct timeval *tv2)
+void put_long_date(char *p, time_t t)
{
- return timeval_add(tv1, tv2->tv_sec, tv2->tv_usec);
+ struct timespec ts;
+ ts.tv_sec = t;
+ ts.tv_nsec = 0;
+ put_long_date_timespec(p, ts);
}
/****************************************************************************
- Return a timeval secs/usecs into the future.
+ Return the best approximation to a 'create time' under UNIX from a stat
+ structure.
****************************************************************************/
-struct timeval timeval_current_ofs(uint32_t secs, uint32_t usecs)
+time_t get_create_time(SMB_STRUCT_STAT *st,BOOL fake_dirs)
{
- struct timeval tv = timeval_current();
- return timeval_add(&tv, secs, usecs);
-}
-
-/****************************************************************************
- Compare two timeval structures.
- Return -1 if tv1 < tv2
- Return 0 if tv1 == tv2
- Return 1 if tv1 > tv2
-****************************************************************************/
+ time_t ret, ret1;
-int timeval_compare(const struct timeval *tv1, const struct timeval *tv2)
-{
- if (tv1->tv_sec > tv2->tv_sec) {
- return 1;
- }
- if (tv1->tv_sec < tv2->tv_sec) {
- return -1;
- }
- if (tv1->tv_usec > tv2->tv_usec) {
- return 1;
- }
- if (tv1->tv_usec < tv2->tv_usec) {
- return -1;
+ if(S_ISDIR(st->st_mode) && fake_dirs) {
+ return (time_t)315493200L; /* 1/1/1980 */
}
- return 0;
-}
-
-/****************************************************************************
- Return the difference between two timevals as a timeval.
- If tv1 comes after tv2, then return a zero timeval
- (this is *tv2 - *tv1).
-****************************************************************************/
+
+ ret = MIN(st->st_ctime, st->st_mtime);
+ ret1 = MIN(ret, st->st_atime);
-struct timeval timeval_until(const struct timeval *tv1,
- const struct timeval *tv2)
-{
- struct timeval t;
- if (timeval_compare(tv1, tv2) >= 0) {
- return timeval_zero();
- }
- t.tv_sec = tv2->tv_sec - tv1->tv_sec;
- if (tv1->tv_usec > tv2->tv_usec) {
- t.tv_sec--;
- t.tv_usec = 1000000 - (tv1->tv_usec - tv2->tv_usec);
- } else {
- t.tv_usec = tv2->tv_usec - tv1->tv_usec;
+ if(ret1 != (time_t)0) {
+ return ret1;
}
- return t;
-}
-/****************************************************************************
- Return the lesser of two timevals.
-****************************************************************************/
-
-struct timeval timeval_min(const struct timeval *tv1,
- const struct timeval *tv2)
-{
- if (tv1->tv_sec < tv2->tv_sec) {
- return *tv1;
- }
- if (tv1->tv_sec > tv2->tv_sec) {
- return *tv2;
- }
- if (tv1->tv_usec < tv2->tv_usec) {
- return *tv1;
- }
- return *tv2;
+ /*
+ * One of ctime, mtime or atime was zero (probably atime).
+ * Just return MIN(ctime, mtime).
+ */
+ return ret;
}
-/****************************************************************************
- Return the greater of two timevals.
-****************************************************************************/
-
-struct timeval timeval_max(const struct timeval *tv1,
- const struct timeval *tv2)
+struct timespec get_create_timespec(SMB_STRUCT_STAT *st,BOOL fake_dirs)
{
- if (tv1->tv_sec > tv2->tv_sec) {
- return *tv1;
- }
- if (tv1->tv_sec < tv2->tv_sec) {
- return *tv2;
- }
- if (tv1->tv_usec > tv2->tv_usec) {
- return *tv1;
- }
- return *tv2;
-}
-
-/****************************************************************************
- Convert ASN.1 GeneralizedTime string to unix-time.
- Returns 0 on failure; Currently ignores timezone.
-****************************************************************************/
-
-time_t generalized_to_unix_time(const char *str)
-{
- struct tm tm;
-
- ZERO_STRUCT(tm);
-
- if (sscanf(str, "%4d%2d%2d%2d%2d%2d",
- &tm.tm_year, &tm.tm_mon, &tm.tm_mday,
- &tm.tm_hour, &tm.tm_min, &tm.tm_sec) != 6) {
- return 0;
- }
- tm.tm_year -= 1900;
- tm.tm_mon -= 1;
-
- return timegm(&tm);
+ struct timespec ts;
+ ts.tv_sec = get_create_time(st, fake_dirs);
+ ts.tv_nsec = 0;
+ return ts;
}
/****************************************************************************
@@ -1262,83 +934,352 @@ void set_ctimespec(SMB_STRUCT_STAT *pst, struct timespec ts)
#endif
}
-#if 0
+void dos_filetime_timespec(struct timespec *tsp)
+{
+ tsp->tv_sec &= ~1;
+ tsp->tv_nsec = 0;
+}
+
+/*******************************************************************
+ Create a unix date (int GMT) from a dos date (which is actually in
+ localtime).
+********************************************************************/
+
+static time_t make_unix_date(void *date_ptr, int zone_offset)
+{
+ uint32 dos_date=0;
+ struct tm t;
+ time_t ret;
+
+ dos_date = IVAL(date_ptr,0);
+
+ if (dos_date == 0) {
+ return 0;
+ }
+
+ interpret_dos_date(dos_date,&t.tm_year,&t.tm_mon,
+ &t.tm_mday,&t.tm_hour,&t.tm_min,&t.tm_sec);
+ t.tm_isdst = -1;
+
+ ret = timegm(&t);
+
+ ret += zone_offset;
+
+ return(ret);
+}
+
+/*******************************************************************
+ Like make_unix_date() but the words are reversed.
+********************************************************************/
+
+static time_t make_unix_date2(void *date_ptr, int zone_offset)
+{
+ uint32 x,x2;
+
+ x = IVAL(date_ptr,0);
+ x2 = ((x&0xFFFF)<<16) | ((x&0xFFFF0000)>>16);
+ SIVAL(&x,0,x2);
+
+ return(make_unix_date((void *)&x, zone_offset));
+}
+
+/*******************************************************************
+ Create a unix GMT date from a dos date in 32 bit "unix like" format
+ these generally arrive as localtimes, with corresponding DST.
+******************************************************************/
+
+static time_t make_unix_date3(void *date_ptr, int zone_offset)
+{
+ time_t t = (time_t)IVAL(date_ptr,0);
+ if (!null_mtime(t)) {
+ t += zone_offset;
+ }
+ return(t);
+}
+
+time_t srv_make_unix_date(void *date_ptr)
+{
+ return make_unix_date(date_ptr, server_zone_offset);
+}
+
+time_t srv_make_unix_date2(void *date_ptr)
+{
+ return make_unix_date2(date_ptr, server_zone_offset);
+}
+
+time_t srv_make_unix_date3(void *date_ptr)
+{
+ return make_unix_date3(date_ptr, server_zone_offset);
+}
+
+time_t convert_timespec_to_time_t(struct timespec ts)
+{
+ /* 1 ns == 1,000,000,000 - one thousand millionths of a second.
+ increment if it's greater than 500 millionth of a second. */
+ if (ts.tv_nsec > 500000000) {
+ return ts.tv_sec + 1;
+ }
+ return ts.tv_sec;
+}
+
/****************************************************************************
- Return the best approximation to a 'create time' under UNIX from a stat
- structure.
+ Interprets an nt time into a unix struct timespec.
+ Differs from nt_time_to_unix in that an 8 byte value of 0xffffffffffffffff
+ will be returned as (time_t)-1, whereas nt_time_to_unix returns 0 in this case.
****************************************************************************/
-struct timespec get_create_timespec(SMB_STRUCT_STAT *st,BOOL fake_dirs)
+struct timespec interpret_long_date(char *p)
{
- time_t ret, ret1;
+ NTTIME nt;
+ nt = IVAL(p,0) + ((uint64_t)IVAL(p,4) << 32);
+ if (nt == (uint64_t)-1) {
+ struct timespec ret;
+ ret.tv_sec = (time_t)-1;
+ ret.tv_nsec = 0;
+ return ret;
+ }
+ return nt_time_to_unix_timespec(&nt);
+}
- if(S_ISDIR(st->st_mode) && fake_dirs) {
- return (time_t)315493200L; /* 1/1/1980 */
+/***************************************************************************
+ Client versions of the above functions.
+***************************************************************************/
+
+void cli_put_dos_date(struct cli_state *cli, char *buf, int offset, time_t unixdate)
+{
+ put_dos_date(buf, offset, unixdate, cli->serverzone);
+}
+
+void cli_put_dos_date2(struct cli_state *cli, char *buf, int offset, time_t unixdate)
+{
+ put_dos_date2(buf, offset, unixdate, cli->serverzone);
+}
+
+void cli_put_dos_date3(struct cli_state *cli, char *buf, int offset, time_t unixdate)
+{
+ put_dos_date3(buf, offset, unixdate, cli->serverzone);
+}
+
+time_t cli_make_unix_date(struct cli_state *cli, void *date_ptr)
+{
+ return make_unix_date(date_ptr, cli->serverzone);
+}
+
+time_t cli_make_unix_date2(struct cli_state *cli, void *date_ptr)
+{
+ return make_unix_date2(date_ptr, cli->serverzone);
+}
+
+time_t cli_make_unix_date3(struct cli_state *cli, void *date_ptr)
+{
+ return make_unix_date3(date_ptr, cli->serverzone);
+}
+
+#if (SIZEOF_LONG == 8)
+#define TIME_FIXUP_CONSTANT_INT 11644473600L
+#elif (SIZEOF_LONG_LONG == 8)
+#define TIME_FIXUP_CONSTANT_INT 11644473600LL
+#endif
+
+
+/* Large integer version. */
+struct timespec nt_time_to_unix_timespec(NTTIME *nt)
+{
+ uint64 d;
+ struct timespec ret;
+
+ if (*nt == 0 || *nt == (uint64)-1) {
+ ret.tv_sec = 0;
+ ret.tv_nsec = 0;
+ return ret;
}
-
- ret = MIN(st->st_ctime, st->st_mtime);
- ret1 = MIN(ret, st->st_atime);
- if(ret1 != (time_t)0) {
- return ret1;
+ d = *nt;
+ /* d is now in 100ns units, since jan 1st 1601".
+ Save off the ns fraction. */
+
+ ret.tv_nsec = (long) ((d % 100) * 100);
+
+ /* Convert to seconds */
+ d /= 1000*1000*10;
+
+ /* Now adjust by 369 years to make the secs since 1970 */
+ d -= TIME_FIXUP_CONSTANT_INT;
+
+ if (((time_t)d) <= TIME_T_MIN) {
+ ret.tv_sec = TIME_T_MIN;
+ ret.tv_nsec = 0;
+ return ret;
}
- /*
- * One of ctime, mtime or atime was zero (probably atime).
- * Just return MIN(ctime, mtime).
- */
- return ret;
+ if (((time_t)d) >= TIME_T_MAX) {
+ ret.tv_sec = TIME_T_MAX;
+ ret.tv_nsec = 0;
+ return ret;
+ }
+
+ ret.tv_sec = (time_t)d;
+ return ret;
}
-#endif
+/****************************************************************************
+ Check if two NTTIMEs are the same.
+****************************************************************************/
-void dos_filetime_timespec(struct timespec *tsp)
+BOOL nt_time_equals(const NTTIME *nt1, const NTTIME *nt2)
{
- tsp->tv_sec &= ~1;
- tsp->tv_nsec = 0;
+ return (*nt1 == *nt2);
}
-/**
- Return the date and time as a string
-**/
-char *timestring(TALLOC_CTX *mem_ctx, time_t t)
+/*******************************************************************
+ Re-read the smb serverzone value.
+******************************************************************/
+
+static struct timeval start_time_hires;
+
+void TimeInit(void)
{
- char *TimeBuf;
- char tempTime[80];
- struct tm *tm;
+ set_server_zone_offset(time(NULL));
- tm = localtime(&t);
- if (!tm) {
- return talloc_asprintf(mem_ctx,
- "%ld seconds since the Epoch",
- (long)t);
+ DEBUG(4,("TimeInit: Serverzone is %d\n", server_zone_offset));
+
+ /* Save the start time of this process. */
+ if (start_time_hires.tv_sec == 0 && start_time_hires.tv_usec == 0) {
+ GetTimeOfDay(&start_time_hires);
}
+}
-#ifdef HAVE_STRFTIME
- /* some versions of gcc complain about using %c. This is a bug
- in the gcc warning, not a bug in this code. See a recent
- strftime() manual page for details.
- */
- strftime(tempTime,sizeof(tempTime)-1,"%c %Z",tm);
- TimeBuf = talloc_strdup(mem_ctx, tempTime);
-#else
- TimeBuf = talloc_strdup(mem_ctx, asctime(tm));
-#endif
+/**********************************************************************
+ Return a timeval struct of the uptime of this process. As TimeInit is
+ done before a daemon fork then this is the start time from the parent
+ daemon start. JRA.
+***********************************************************************/
- return TimeBuf;
+void get_process_uptime(struct timeval *ret_time)
+{
+ struct timeval time_now_hires;
+
+ GetTimeOfDay(&time_now_hires);
+ ret_time->tv_sec = time_now_hires.tv_sec - start_time_hires.tv_sec;
+ if (time_now_hires.tv_usec < start_time_hires.tv_usec) {
+ ret_time->tv_sec -= 1;
+ ret_time->tv_usec = 1000000 + (time_now_hires.tv_usec - start_time_hires.tv_usec);
+ } else {
+ ret_time->tv_usec = time_now_hires.tv_usec - start_time_hires.tv_usec;
+ }
}
+/****************************************************************************
+ Convert a NTTIME structure to a time_t.
+ It's originally in "100ns units".
+
+ This is an absolute version of the one above.
+ By absolute I mean, it doesn't adjust from 1/1/1601 to 1/1/1970
+ if the NTTIME was 5 seconds, the time_t is 5 seconds. JFM
+****************************************************************************/
-/**
- return a talloced string representing a NTTIME for human consumption
-*/
-const char *nt_time_string(TALLOC_CTX *mem_ctx, NTTIME nt)
+time_t nt_time_to_unix_abs(const NTTIME *nt)
{
- time_t t;
- if (nt.low == 0 && nt.high == 0) {
- return "NTTIME(0)";
+ uint64 d;
+
+ if (*nt == 0) {
+ return (time_t)0;
}
- t = nt_time_to_unix(&nt);
- return timestring(mem_ctx, t);
+
+ if (*nt == (uint64)-1) {
+ return (time_t)-1;
+ }
+
+ /* reverse the time */
+ /* it's a negative value, turn it to positive */
+ d=~*nt;
+
+ d += 1000*1000*10/2;
+ d /= 1000*1000*10;
+
+ if (!(TIME_T_MIN <= ((time_t)d) && ((time_t)d) <= TIME_T_MAX)) {
+ return (time_t)0;
+ }
+
+ return (time_t)d;
+}
+
+/****************************************************************************
+ Put a 8 byte filetime from a struct timespec. Uses GMT.
+****************************************************************************/
+
+void unix_timespec_to_nt_time(NTTIME *nt, struct timespec ts)
+{
+ uint64 d;
+
+ if (ts.tv_sec ==0 && ts.tv_nsec == 0) {
+ *nt = 0;
+ return;
+ }
+ if (ts.tv_sec == TIME_T_MAX) {
+ *nt = 0x7fffffffffffffffLL;
+ return;
+ }
+ if (ts.tv_sec == (time_t)-1) {
+ *nt = (uint64)-1;
+ return;
+ }
+
+ d = ts.tv_sec;
+ d += TIME_FIXUP_CONSTANT_INT;
+ d *= 1000*1000*10;
+ /* d is now in 100ns units. */
+ d += (ts.tv_nsec / 100);
+
+ *nt = d;
+}
+
+/****************************************************************************
+ Convert a time_t to a NTTIME structure
+
+ This is an absolute version of the one above.
+ By absolute I mean, it doesn't adjust from 1/1/1970 to 1/1/1601
+ If the nttime_t was 5 seconds, the NTTIME is 5 seconds. JFM
+****************************************************************************/
+
+void unix_to_nt_time_abs(NTTIME *nt, time_t t)
+{
+ double d;
+
+ if (t==0) {
+ *nt = 0;
+ return;
+ }
+
+ if (t == TIME_T_MAX) {
+ *nt = 0x7fffffffffffffffLL;
+ return;
+ }
+
+ if (t == (time_t)-1) {
+ /* that's what NT uses for infinite */
+ *nt = 0x8000000000000000LL;
+ return;
+ }
+
+ d = (double)(t);
+ d *= 1.0e7;
+
+ *nt = d;
+
+ /* convert to a negative value */
+ *nt=~*nt;
+}
+
+
+/****************************************************************************
+ Check if it's a null mtime.
+****************************************************************************/
+
+BOOL null_mtime(time_t mtime)
+{
+ if (mtime == 0 || mtime == (time_t)0xFFFFFFFF || mtime == (time_t)-1)
+ return(True);
+ return(False);
}
/****************************************************************************
@@ -1361,3 +1302,52 @@ const char *time_to_asc(const time_t *t)
}
return asct;
}
+
+const char *display_time(NTTIME nttime)
+{
+ static fstring string;
+
+ float high;
+ float low;
+ int sec;
+ int days, hours, mins, secs;
+
+ if (nttime==0)
+ return "Now";
+
+ if (nttime==0x8000000000000000LL)
+ return "Never";
+
+ high = 65536;
+ high = high/10000;
+ high = high*65536;
+ high = high/1000;
+ high = high * (~(nttime >> 32));
+
+ low = ~(nttime & 0xFFFFFFFF);
+ low = low/(1000*1000*10);
+
+ sec=high+low;
+
+ days=sec/(60*60*24);
+ hours=(sec - (days*60*60*24)) / (60*60);
+ mins=(sec - (days*60*60*24) - (hours*60*60) ) / 60;
+ secs=sec - (days*60*60*24) - (hours*60*60) - (mins*60);
+
+ fstr_sprintf(string, "%u days, %u hours, %u minutes, %u seconds", days, hours, mins, secs);
+ return (string);
+}
+
+BOOL nt_time_is_set(const NTTIME *nt)
+{
+ if (*nt == 0x7FFFFFFFFFFFFFFFLL) {
+ return False;
+ }
+
+ if (*nt == 0x8000000000000000LL) {
+ return False;
+ }
+
+ return True;
+}
+
diff --git a/source3/libads/authdata.c b/source3/libads/authdata.c
index c3c160dafb..71294941a6 100644
--- a/source3/libads/authdata.c
+++ b/source3/libads/authdata.c
@@ -878,9 +878,9 @@ static void dump_pac_logon_info(PAC_LOGON_INFO *logon_info) {
DEBUG(2,("decode_pac_data: Logon time mismatch between ticket and PAC!\n"));
DEBUGADD(2, ("decode_pac_data: PAC: %s\n",
- http_timestring(nt_time_to_unix(&logon_name->logon_time))));
+ http_timestring(nt_time_to_unix(logon_name->logon_time))));
DEBUGADD(2, ("decode_pac_data: Ticket: %s\n",
- http_timestring(nt_time_to_unix(&tgs_authtime_nttime))));
+ http_timestring(nt_time_to_unix(tgs_authtime_nttime))));
nt_status = NT_STATUS_ACCESS_DENIED;
goto out;
diff --git a/source3/libmsrpc/libmsrpc.c b/source3/libmsrpc/libmsrpc.c
index 5f71af21da..d96eaf5916 100644
--- a/source3/libmsrpc/libmsrpc.c
+++ b/source3/libmsrpc/libmsrpc.c
@@ -239,19 +239,19 @@ void cac_InitCacTime(CacTime *cactime, NTTIME nttime) {
ZERO_STRUCTP(cactime);
/*this code is taken from display_time() found in rpcclient/cmd_samr.c*/
- if (nttime.high==0 && nttime.low==0)
+ if (nttime==0)
return;
- if (nttime.high==0x80000000 && nttime.low==0)
+ if (nttime==0x80000000000000LL)
return;
high = 65536;
high = high/10000;
high = high*65536;
high = high/1000;
- high = high * (~nttime.high);
+ high = high * (~(nttime >> 32));
- low = ~nttime.low;
+ low = ~(nttime & 0xFFFFFFFF);
low = low/(1000*1000*10);
sec=high+low;
diff --git a/source3/libmsrpc/libmsrpc_internal.c b/source3/libmsrpc/libmsrpc_internal.c
index a1c37aaac4..db884d3bf0 100644
--- a/source3/libmsrpc/libmsrpc_internal.c
+++ b/source3/libmsrpc/libmsrpc_internal.c
@@ -448,12 +448,12 @@ CacUserInfo *cac_MakeUserInfo(TALLOC_CTX *mem_ctx, SAM_USERINFO_CTR *ctr) {
ZERO_STRUCTP(info);
- info->logon_time = nt_time_to_unix(&id21->logon_time);
- info->logoff_time = nt_time_to_unix(&id21->logoff_time);
- info->kickoff_time = nt_time_to_unix(&id21->kickoff_time);
- info->pass_last_set_time = nt_time_to_unix(&id21->pass_last_set_time);
- info->pass_can_change_time = nt_time_to_unix(&id21->pass_can_change_time);
- info->pass_must_change_time = nt_time_to_unix(&id21->pass_must_change_time);
+ info->logon_time = nt_time_to_unix(id21->logon_time);
+ info->logoff_time = nt_time_to_unix(id21->logoff_time);
+ info->kickoff_time = nt_time_to_unix(id21->kickoff_time);
+ info->pass_last_set_time = nt_time_to_unix(id21->pass_last_set_time);
+ info->pass_can_change_time = nt_time_to_unix(id21->pass_can_change_time);
+ info->pass_must_change_time = nt_time_to_unix(id21->pass_must_change_time);
info->username = talloc_unistr2_to_ascii(mem_ctx, id21->uni_user_name);
if(!info->username)
diff --git a/source3/libndr/ndr_basic.c b/source3/libndr/ndr_basic.c
index 31a48f67c4..ce2af31784 100644
--- a/source3/libndr/ndr_basic.c
+++ b/source3/libndr/ndr_basic.c
@@ -22,15 +22,6 @@
#include "includes.h"
-/* Evil hack to convert Samba3 NTTIME's to Samba4 NTTIME's */
-
-union NTTIME_big {
- NTTIME s3;
- uint64_t s4;
-};
-
-
-
#define NDR_SVAL(ndr, ofs) (NDR_BE(ndr)?RSVAL(ndr->data,ofs):SVAL(ndr->data,ofs))
#define NDR_IVAL(ndr, ofs) (NDR_BE(ndr)?RIVAL(ndr->data,ofs):IVAL(ndr->data,ofs))
#define NDR_IVALS(ndr, ofs) (NDR_BE(ndr)?RIVALS(ndr->data,ofs):IVALS(ndr->data,ofs))
@@ -514,8 +505,7 @@ NTSTATUS ndr_push_ref_ptr(struct ndr_push *ndr, const void *p)
*/
NTSTATUS ndr_push_NTTIME(struct ndr_push *ndr, int ndr_flags, NTTIME t)
{
- union NTTIME_big b; b.s3 = t;
- NDR_CHECK(ndr_push_udlong(ndr, ndr_flags, b.s4));
+ NDR_CHECK(ndr_push_udlong(ndr, ndr_flags, t));
return NT_STATUS_OK;
}
@@ -524,10 +514,7 @@ NTSTATUS ndr_push_NTTIME(struct ndr_push *ndr, int ndr_flags, NTTIME t)
*/
NTSTATUS ndr_pull_NTTIME(struct ndr_pull *ndr, int ndr_flags, NTTIME *t)
{
- union NTTIME_big b;
- NDR_CHECK(ndr_pull_udlong(ndr, ndr_flags, &b.s4));
-
- *t = b.s3;
+ NDR_CHECK(ndr_pull_udlong(ndr, ndr_flags, t));
return NT_STATUS_OK;
}
@@ -536,10 +523,8 @@ NTSTATUS ndr_pull_NTTIME(struct ndr_pull *ndr, int ndr_flags, NTTIME *t)
*/
NTSTATUS ndr_push_NTTIME_1sec(struct ndr_push *ndr, int ndr_flags, NTTIME t)
{
- union NTTIME_big b; b.s3 = t;
-
- b.s4 /= 10000000;
- NDR_CHECK(ndr_push_hyper(ndr, ndr_flags, b.s4));
+ t /= 10000000;
+ NDR_CHECK(ndr_push_hyper(ndr, ndr_flags, t));
return NT_STATUS_OK;
}
@@ -548,10 +533,8 @@ NTSTATUS ndr_push_NTTIME_1sec(struct ndr_push *ndr, int ndr_flags, NTTIME t)
*/
NTSTATUS ndr_pull_NTTIME_1sec(struct ndr_pull *ndr, int ndr_flags, NTTIME *t)
{
- union NTTIME_big b;
- NDR_CHECK(ndr_pull_hyper(ndr, ndr_flags, &b.s4));
- b.s4 *= 10000000;
- *t = b.s3;
+ NDR_CHECK(ndr_pull_hyper(ndr, ndr_flags, t));
+ (*t) *= 10000000;
return NT_STATUS_OK;
}
@@ -560,9 +543,7 @@ NTSTATUS ndr_pull_NTTIME_1sec(struct ndr_pull *ndr, int ndr_flags, NTTIME *t)
*/
NTSTATUS ndr_pull_NTTIME_hyper(struct ndr_pull *ndr, int ndr_flags, NTTIME *t)
{
- union NTTIME_big b;
- NDR_CHECK(ndr_pull_hyper(ndr, ndr_flags, &b.s4));
- *t = b.s3;
+ NDR_CHECK(ndr_pull_hyper(ndr, ndr_flags, t));
return NT_STATUS_OK;
}
@@ -571,8 +552,7 @@ NTSTATUS ndr_pull_NTTIME_hyper(struct ndr_pull *ndr, int ndr_flags, NTTIME *t)
*/
NTSTATUS ndr_push_NTTIME_hyper(struct ndr_push *ndr, int ndr_flags, NTTIME t)
{
- union NTTIME_big b; b.s3 = t;
- NDR_CHECK(ndr_push_hyper(ndr, ndr_flags, b.s4));
+ NDR_CHECK(ndr_push_hyper(ndr, ndr_flags, t));
return NT_STATUS_OK;
}
diff --git a/source3/libndr/ndr_unixinfo.c b/source3/libndr/ndr_unixinfo.c
new file mode 100644
index 0000000000..61b4f4696a
--- /dev/null
+++ b/source3/libndr/ndr_unixinfo.c
@@ -0,0 +1,504 @@
+/* parser auto-generated by pidl */
+
+#include "includes.h"
+#include "libndr/ndr_unixinfo.h"
+static NTSTATUS ndr_push_unixinfo_GetPWUidInfo(struct ndr_push *ndr, int ndr_flags, const struct unixinfo_GetPWUidInfo *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->status));
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->homedir));
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->shell));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ if (r->homedir) {
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->homedir, CH_UTF8)));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->homedir, CH_UTF8)));
+ NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->homedir, ndr_charset_length(r->homedir, CH_UTF8), sizeof(uint8_t), CH_UTF8));
+ }
+ if (r->shell) {
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->shell, CH_UTF8)));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->shell, CH_UTF8)));
+ NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->shell, ndr_charset_length(r->shell, CH_UTF8), sizeof(uint8_t), CH_UTF8));
+ }
+ }
+ return NT_STATUS_OK;
+}
+
+static NTSTATUS ndr_pull_unixinfo_GetPWUidInfo(struct ndr_pull *ndr, int ndr_flags, struct unixinfo_GetPWUidInfo *r)
+{
+ uint32_t _ptr_homedir;
+ TALLOC_CTX *_mem_save_homedir_0;
+ uint32_t _ptr_shell;
+ TALLOC_CTX *_mem_save_shell_0;
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->status));
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_homedir));
+ if (_ptr_homedir) {
+ NDR_PULL_ALLOC_SIZE(ndr, r->homedir, 1);
+ } else {
+ r->homedir = NULL;
+ }
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_shell));
+ if (_ptr_shell) {
+ NDR_PULL_ALLOC_SIZE(ndr, r->shell, 1);
+ } else {
+ r->shell = NULL;
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ if (r->homedir) {
+ _mem_save_homedir_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->homedir, 0);
+ NDR_CHECK(ndr_pull_array_size(ndr, &r->homedir));
+ NDR_CHECK(ndr_pull_array_length(ndr, &r->homedir));
+ if (ndr_get_array_length(ndr, &r->homedir) > ndr_get_array_size(ndr, &r->homedir)) {
+ return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->homedir), ndr_get_array_length(ndr, &r->homedir));
+ }
+ NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->homedir), sizeof(uint8_t)));
+ NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->homedir, ndr_get_array_length(ndr, &r->homedir), sizeof(uint8_t), CH_UTF8));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_homedir_0, 0);
+ }
+ if (r->shell) {
+ _mem_save_shell_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->shell, 0);
+ NDR_CHECK(ndr_pull_array_size(ndr, &r->shell));
+ NDR_CHECK(ndr_pull_array_length(ndr, &r->shell));
+ if (ndr_get_array_length(ndr, &r->shell) > ndr_get_array_size(ndr, &r->shell)) {
+ return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->shell), ndr_get_array_length(ndr, &r->shell));
+ }
+ NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->shell), sizeof(uint8_t)));
+ NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->shell, ndr_get_array_length(ndr, &r->shell), sizeof(uint8_t), CH_UTF8));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_shell_0, 0);
+ }
+ }
+ return NT_STATUS_OK;
+}
+
+void ndr_print_unixinfo_GetPWUidInfo(struct ndr_print *ndr, const char *name, const struct unixinfo_GetPWUidInfo *r)
+{
+ ndr_print_struct(ndr, name, "unixinfo_GetPWUidInfo");
+ ndr->depth++;
+ ndr_print_NTSTATUS(ndr, "status", r->status);
+ ndr_print_ptr(ndr, "homedir", r->homedir);
+ ndr->depth++;
+ if (r->homedir) {
+ ndr_print_string(ndr, "homedir", r->homedir);
+ }
+ ndr->depth--;
+ ndr_print_ptr(ndr, "shell", r->shell);
+ ndr->depth++;
+ if (r->shell) {
+ ndr_print_string(ndr, "shell", r->shell);
+ }
+ ndr->depth--;
+ ndr->depth--;
+}
+
+NTSTATUS ndr_push_unixinfo_SidToUid(struct ndr_push *ndr, int flags, const struct unixinfo_SidToUid *r)
+{
+ if (flags & NDR_IN) {
+ NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.sid));
+ }
+ if (flags & NDR_OUT) {
+ if (r->out.uid == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
+ NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, *r->out.uid));
+ NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+ }
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_pull_unixinfo_SidToUid(struct ndr_pull *ndr, int flags, struct unixinfo_SidToUid *r)
+{
+ TALLOC_CTX *_mem_save_uid_0;
+ if (flags & NDR_IN) {
+ ZERO_STRUCT(r->out);
+
+ NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.sid));
+ NDR_PULL_ALLOC(ndr, r->out.uid);
+ ZERO_STRUCTP(r->out.uid);
+ }
+ if (flags & NDR_OUT) {
+ if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+ NDR_PULL_ALLOC(ndr, r->out.uid);
+ }
+ _mem_save_uid_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->out.uid, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, r->out.uid));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_uid_0, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+ }
+ return NT_STATUS_OK;
+}
+
+void ndr_print_unixinfo_SidToUid(struct ndr_print *ndr, const char *name, int flags, const struct unixinfo_SidToUid *r)
+{
+ ndr_print_struct(ndr, name, "unixinfo_SidToUid");
+ ndr->depth++;
+ if (flags & NDR_SET_VALUES) {
+ ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+ }
+ if (flags & NDR_IN) {
+ ndr_print_struct(ndr, "in", "unixinfo_SidToUid");
+ ndr->depth++;
+ ndr_print_dom_sid(ndr, "sid", &r->in.sid);
+ ndr->depth--;
+ }
+ if (flags & NDR_OUT) {
+ ndr_print_struct(ndr, "out", "unixinfo_SidToUid");
+ ndr->depth++;
+ ndr_print_ptr(ndr, "uid", r->out.uid);
+ ndr->depth++;
+ ndr_print_hyper(ndr, "uid", *r->out.uid);
+ ndr->depth--;
+ ndr_print_NTSTATUS(ndr, "result", r->out.result);
+ ndr->depth--;
+ }
+ ndr->depth--;
+}
+
+NTSTATUS ndr_push_unixinfo_UidToSid(struct ndr_push *ndr, int flags, const struct unixinfo_UidToSid *r)
+{
+ if (flags & NDR_IN) {
+ NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->in.uid));
+ }
+ if (flags & NDR_OUT) {
+ if (r->out.sid == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
+ NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sid));
+ NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+ }
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_pull_unixinfo_UidToSid(struct ndr_pull *ndr, int flags, struct unixinfo_UidToSid *r)
+{
+ TALLOC_CTX *_mem_save_sid_0;
+ if (flags & NDR_IN) {
+ ZERO_STRUCT(r->out);
+
+ NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->in.uid));
+ NDR_PULL_ALLOC(ndr, r->out.sid);
+ ZERO_STRUCTP(r->out.sid);
+ }
+ if (flags & NDR_OUT) {
+ if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+ NDR_PULL_ALLOC(ndr, r->out.sid);
+ }
+ _mem_save_sid_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->out.sid, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sid));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sid_0, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+ }
+ return NT_STATUS_OK;
+}
+
+void ndr_print_unixinfo_UidToSid(struct ndr_print *ndr, const char *name, int flags, const struct unixinfo_UidToSid *r)
+{
+ ndr_print_struct(ndr, name, "unixinfo_UidToSid");
+ ndr->depth++;
+ if (flags & NDR_SET_VALUES) {
+ ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+ }
+ if (flags & NDR_IN) {
+ ndr_print_struct(ndr, "in", "unixinfo_UidToSid");
+ ndr->depth++;
+ ndr_print_hyper(ndr, "uid", r->in.uid);
+ ndr->depth--;
+ }
+ if (flags & NDR_OUT) {
+ ndr_print_struct(ndr, "out", "unixinfo_UidToSid");
+ ndr->depth++;
+ ndr_print_ptr(ndr, "sid", r->out.sid);
+ ndr->depth++;
+ ndr_print_dom_sid(ndr, "sid", r->out.sid);
+ ndr->depth--;
+ ndr_print_NTSTATUS(ndr, "result", r->out.result);
+ ndr->depth--;
+ }
+ ndr->depth--;
+}
+
+NTSTATUS ndr_push_unixinfo_SidToGid(struct ndr_push *ndr, int flags, const struct unixinfo_SidToGid *r)
+{
+ if (flags & NDR_IN) {
+ NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.sid));
+ }
+ if (flags & NDR_OUT) {
+ if (r->out.gid == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
+ NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, *r->out.gid));
+ NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+ }
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_pull_unixinfo_SidToGid(struct ndr_pull *ndr, int flags, struct unixinfo_SidToGid *r)
+{
+ TALLOC_CTX *_mem_save_gid_0;
+ if (flags & NDR_IN) {
+ ZERO_STRUCT(r->out);
+
+ NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.sid));
+ NDR_PULL_ALLOC(ndr, r->out.gid);
+ ZERO_STRUCTP(r->out.gid);
+ }
+ if (flags & NDR_OUT) {
+ if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+ NDR_PULL_ALLOC(ndr, r->out.gid);
+ }
+ _mem_save_gid_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->out.gid, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, r->out.gid));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_gid_0, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+ }
+ return NT_STATUS_OK;
+}
+
+void ndr_print_unixinfo_SidToGid(struct ndr_print *ndr, const char *name, int flags, const struct unixinfo_SidToGid *r)
+{
+ ndr_print_struct(ndr, name, "unixinfo_SidToGid");
+ ndr->depth++;
+ if (flags & NDR_SET_VALUES) {
+ ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+ }
+ if (flags & NDR_IN) {
+ ndr_print_struct(ndr, "in", "unixinfo_SidToGid");
+ ndr->depth++;
+ ndr_print_dom_sid(ndr, "sid", &r->in.sid);
+ ndr->depth--;
+ }
+ if (flags & NDR_OUT) {
+ ndr_print_struct(ndr, "out", "unixinfo_SidToGid");
+ ndr->depth++;
+ ndr_print_ptr(ndr, "gid", r->out.gid);
+ ndr->depth++;
+ ndr_print_hyper(ndr, "gid", *r->out.gid);
+ ndr->depth--;
+ ndr_print_NTSTATUS(ndr, "result", r->out.result);
+ ndr->depth--;
+ }
+ ndr->depth--;
+}
+
+NTSTATUS ndr_push_unixinfo_GidToSid(struct ndr_push *ndr, int flags, const struct unixinfo_GidToSid *r)
+{
+ if (flags & NDR_IN) {
+ NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->in.gid));
+ }
+ if (flags & NDR_OUT) {
+ if (r->out.sid == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
+ NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sid));
+ NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+ }
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_pull_unixinfo_GidToSid(struct ndr_pull *ndr, int flags, struct unixinfo_GidToSid *r)
+{
+ TALLOC_CTX *_mem_save_sid_0;
+ if (flags & NDR_IN) {
+ ZERO_STRUCT(r->out);
+
+ NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->in.gid));
+ NDR_PULL_ALLOC(ndr, r->out.sid);
+ ZERO_STRUCTP(r->out.sid);
+ }
+ if (flags & NDR_OUT) {
+ if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+ NDR_PULL_ALLOC(ndr, r->out.sid);
+ }
+ _mem_save_sid_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->out.sid, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sid));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sid_0, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+ }
+ return NT_STATUS_OK;
+}
+
+void ndr_print_unixinfo_GidToSid(struct ndr_print *ndr, const char *name, int flags, const struct unixinfo_GidToSid *r)
+{
+ ndr_print_struct(ndr, name, "unixinfo_GidToSid");
+ ndr->depth++;
+ if (flags & NDR_SET_VALUES) {
+ ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+ }
+ if (flags & NDR_IN) {
+ ndr_print_struct(ndr, "in", "unixinfo_GidToSid");
+ ndr->depth++;
+ ndr_print_hyper(ndr, "gid", r->in.gid);
+ ndr->depth--;
+ }
+ if (flags & NDR_OUT) {
+ ndr_print_struct(ndr, "out", "unixinfo_GidToSid");
+ ndr->depth++;
+ ndr_print_ptr(ndr, "sid", r->out.sid);
+ ndr->depth++;
+ ndr_print_dom_sid(ndr, "sid", r->out.sid);
+ ndr->depth--;
+ ndr_print_NTSTATUS(ndr, "result", r->out.result);
+ ndr->depth--;
+ }
+ ndr->depth--;
+}
+
+NTSTATUS ndr_push_unixinfo_GetPWUid(struct ndr_push *ndr, int flags, const struct unixinfo_GetPWUid *r)
+{
+ uint32_t cntr_uids_0;
+ uint32_t cntr_infos_1;
+ if (flags & NDR_IN) {
+ if (r->in.count == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.count));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.count));
+ for (cntr_uids_0 = 0; cntr_uids_0 < *r->in.count; cntr_uids_0++) {
+ NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->in.uids[cntr_uids_0]));
+ }
+ }
+ if (flags & NDR_OUT) {
+ if (r->out.count == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.count));
+ if (r->out.infos == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.count));
+ for (cntr_infos_1 = 0; cntr_infos_1 < *r->out.count; cntr_infos_1++) {
+ NDR_CHECK(ndr_push_unixinfo_GetPWUidInfo(ndr, NDR_SCALARS, &r->out.infos[cntr_infos_1]));
+ }
+ for (cntr_infos_1 = 0; cntr_infos_1 < *r->out.count; cntr_infos_1++) {
+ NDR_CHECK(ndr_push_unixinfo_GetPWUidInfo(ndr, NDR_BUFFERS, &r->out.infos[cntr_infos_1]));
+ }
+ NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
+ }
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_pull_unixinfo_GetPWUid(struct ndr_pull *ndr, int flags, struct unixinfo_GetPWUid *r)
+{
+ uint32_t cntr_uids_0;
+ uint32_t cntr_infos_1;
+ TALLOC_CTX *_mem_save_count_0;
+ TALLOC_CTX *_mem_save_uids_0;
+ TALLOC_CTX *_mem_save_infos_1;
+ if (flags & NDR_IN) {
+ ZERO_STRUCT(r->out);
+
+ if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+ NDR_PULL_ALLOC(ndr, r->in.count);
+ }
+ _mem_save_count_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->in.count, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.count));
+ if (*r->in.count < 0 || *r->in.count > 1023) {
+ return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
+ }
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_count_0, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_array_size(ndr, &r->in.uids));
+ NDR_PULL_ALLOC_N(ndr, r->in.uids, ndr_get_array_size(ndr, &r->in.uids));
+ _mem_save_uids_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->in.uids, 0);
+ for (cntr_uids_0 = 0; cntr_uids_0 < *r->in.count; cntr_uids_0++) {
+ NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->in.uids[cntr_uids_0]));
+ }
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_uids_0, 0);
+ NDR_PULL_ALLOC(ndr, r->out.count);
+ *r->out.count = *r->in.count;
+ if (r->in.count == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
+ NDR_PULL_ALLOC_N(ndr, r->out.infos, *r->in.count);
+ memset(r->out.infos, 0, *r->in.count * sizeof(*r->out.infos));
+ if (r->in.uids) {
+ if (r->in.count == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
+ NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->in.uids, *r->in.count));
+ }
+ }
+ if (flags & NDR_OUT) {
+ if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+ NDR_PULL_ALLOC(ndr, r->out.count);
+ }
+ _mem_save_count_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->out.count, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.count));
+ if (*r->out.count < 0 || *r->out.count > 1023) {
+ return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
+ }
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_count_0, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_array_size(ndr, &r->out.infos));
+ if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+ NDR_PULL_ALLOC_N(ndr, r->out.infos, ndr_get_array_size(ndr, &r->out.infos));
+ }
+ _mem_save_infos_1 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->out.infos, 0);
+ for (cntr_infos_1 = 0; cntr_infos_1 < *r->out.count; cntr_infos_1++) {
+ NDR_CHECK(ndr_pull_unixinfo_GetPWUidInfo(ndr, NDR_SCALARS, &r->out.infos[cntr_infos_1]));
+ }
+ for (cntr_infos_1 = 0; cntr_infos_1 < *r->out.count; cntr_infos_1++) {
+ NDR_CHECK(ndr_pull_unixinfo_GetPWUidInfo(ndr, NDR_BUFFERS, &r->out.infos[cntr_infos_1]));
+ }
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_infos_1, 0);
+ NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
+ if (r->out.infos) {
+ if (r->out.count == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
+ NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->out.infos, *r->out.count));
+ }
+ }
+ return NT_STATUS_OK;
+}
+
+void ndr_print_unixinfo_GetPWUid(struct ndr_print *ndr, const char *name, int flags, const struct unixinfo_GetPWUid *r)
+{
+ uint32_t cntr_uids_0;
+ uint32_t cntr_infos_1;
+ ndr_print_struct(ndr, name, "unixinfo_GetPWUid");
+ ndr->depth++;
+ if (flags & NDR_SET_VALUES) {
+ ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+ }
+ if (flags & NDR_IN) {
+ ndr_print_struct(ndr, "in", "unixinfo_GetPWUid");
+ ndr->depth++;
+ ndr_print_ptr(ndr, "count", r->in.count);
+ ndr->depth++;
+ ndr_print_uint32(ndr, "count", *r->in.count);
+ ndr->depth--;
+ ndr->print(ndr, "%s: ARRAY(%d)", "uids", *r->in.count);
+ ndr->depth++;
+ for (cntr_uids_0=0;cntr_uids_0<*r->in.count;cntr_uids_0++) {
+ char *idx_0=NULL;
+ asprintf(&idx_0, "[%d]", cntr_uids_0);
+ if (idx_0) {
+ ndr_print_hyper(ndr, "uids", r->in.uids[cntr_uids_0]);
+ free(idx_0);
+ }
+ }
+ ndr->depth--;
+ ndr->depth--;
+ }
+ if (flags & NDR_OUT) {
+ ndr_print_struct(ndr, "out", "unixinfo_GetPWUid");
+ ndr->depth++;
+ ndr_print_ptr(ndr, "count", r->out.count);
+ ndr->depth++;
+ ndr_print_uint32(ndr, "count", *r->out.count);
+ ndr->depth--;
+ ndr_print_ptr(ndr, "infos", r->out.infos);
+ ndr->depth++;
+ ndr->print(ndr, "%s: ARRAY(%d)", "infos", *r->out.count);
+ ndr->depth++;
+ for (cntr_infos_1=0;cntr_infos_1<*r->out.count;cntr_infos_1++) {
+ char *idx_1=NULL;
+ asprintf(&idx_1, "[%d]", cntr_infos_1);
+ if (idx_1) {
+ ndr_print_unixinfo_GetPWUidInfo(ndr, "infos", &r->out.infos[cntr_infos_1]);
+ free(idx_1);
+ }
+ }
+ ndr->depth--;
+ ndr->depth--;
+ ndr_print_NTSTATUS(ndr, "result", r->out.result);
+ ndr->depth--;
+ }
+ ndr->depth--;
+}
+
+
diff --git a/source3/libndr/ndr_unixinfo.h b/source3/libndr/ndr_unixinfo.h
new file mode 100644
index 0000000000..1741cfc35f
--- /dev/null
+++ b/source3/libndr/ndr_unixinfo.h
@@ -0,0 +1,41 @@
+/* header auto-generated by pidl */
+
+#include "libndr/unixinfo.h"
+
+#ifndef _HEADER_NDR_unixinfo
+#define _HEADER_NDR_unixinfo
+
+#define DCERPC_UNIXINFO_UUID "9c54e310-a955-4885-bd31-78787147dfa6"
+#define DCERPC_UNIXINFO_VERSION 0.0
+#define DCERPC_UNIXINFO_NAME "unixinfo"
+#define DCERPC_UNIXINFO_HELPSTRING "Unixinfo specific stuff"
+extern const struct dcerpc_interface_table dcerpc_table_unixinfo;
+NTSTATUS dcerpc_server_unixinfo_init(void);
+#define DCERPC_UNIXINFO_SIDTOUID (0x00)
+
+#define DCERPC_UNIXINFO_UIDTOSID (0x01)
+
+#define DCERPC_UNIXINFO_SIDTOGID (0x02)
+
+#define DCERPC_UNIXINFO_GIDTOSID (0x03)
+
+#define DCERPC_UNIXINFO_GETPWUID (0x04)
+
+#define DCERPC_UNIXINFO_CALL_COUNT (5)
+void ndr_print_unixinfo_GetPWUidInfo(struct ndr_print *ndr, const char *name, const struct unixinfo_GetPWUidInfo *r);
+NTSTATUS ndr_push_unixinfo_SidToUid(struct ndr_push *ndr, int flags, const struct unixinfo_SidToUid *r);
+NTSTATUS ndr_pull_unixinfo_SidToUid(struct ndr_pull *ndr, int flags, struct unixinfo_SidToUid *r);
+void ndr_print_unixinfo_SidToUid(struct ndr_print *ndr, const char *name, int flags, const struct unixinfo_SidToUid *r);
+NTSTATUS ndr_push_unixinfo_UidToSid(struct ndr_push *ndr, int flags, const struct unixinfo_UidToSid *r);
+NTSTATUS ndr_pull_unixinfo_UidToSid(struct ndr_pull *ndr, int flags, struct unixinfo_UidToSid *r);
+void ndr_print_unixinfo_UidToSid(struct ndr_print *ndr, const char *name, int flags, const struct unixinfo_UidToSid *r);
+NTSTATUS ndr_push_unixinfo_SidToGid(struct ndr_push *ndr, int flags, const struct unixinfo_SidToGid *r);
+NTSTATUS ndr_pull_unixinfo_SidToGid(struct ndr_pull *ndr, int flags, struct unixinfo_SidToGid *r);
+void ndr_print_unixinfo_SidToGid(struct ndr_print *ndr, const char *name, int flags, const struct unixinfo_SidToGid *r);
+NTSTATUS ndr_push_unixinfo_GidToSid(struct ndr_push *ndr, int flags, const struct unixinfo_GidToSid *r);
+NTSTATUS ndr_pull_unixinfo_GidToSid(struct ndr_pull *ndr, int flags, struct unixinfo_GidToSid *r);
+void ndr_print_unixinfo_GidToSid(struct ndr_print *ndr, const char *name, int flags, const struct unixinfo_GidToSid *r);
+NTSTATUS ndr_push_unixinfo_GetPWUid(struct ndr_push *ndr, int flags, const struct unixinfo_GetPWUid *r);
+NTSTATUS ndr_pull_unixinfo_GetPWUid(struct ndr_pull *ndr, int flags, struct unixinfo_GetPWUid *r);
+void ndr_print_unixinfo_GetPWUid(struct ndr_print *ndr, const char *name, int flags, const struct unixinfo_GetPWUid *r);
+#endif /* _HEADER_NDR_unixinfo */
diff --git a/source3/libndr/security.h b/source3/libndr/security.h
index 8f790f387e..61e0ea313f 100644
--- a/source3/libndr/security.h
+++ b/source3/libndr/security.h
@@ -135,13 +135,6 @@ enum sec_privilege {
SEC_PRIV_REMOTE_INTERACTIVE_LOGON=24
};
-struct dom_sid {
- uint8_t sid_rev_num;
- int8_t num_auths;/* [range(0 15)] */
- uint8_t id_auth[6];
- uint32_t *sub_auths;
-}/* [noprint,gensize,noejs,public,nosize] */;
-
/* bitmap security_ace_flags */
#define SEC_ACE_FLAG_OBJECT_INHERIT ( 0x01 )
#define SEC_ACE_FLAG_CONTAINER_INHERIT ( 0x02 )
diff --git a/source3/libndr/sid.c b/source3/libndr/sid.c
index 0bb42a3683..f8c284e93c 100644
--- a/source3/libndr/sid.c
+++ b/source3/libndr/sid.c
@@ -42,22 +42,17 @@ NTSTATUS ndr_push_dom_sid(struct ndr_push *ndr, int ndr_flags, const struct dom_
NTSTATUS ndr_pull_dom_sid(struct ndr_pull *ndr, int ndr_flags, struct dom_sid *r)
{
uint32_t cntr_sub_auths_0;
- TALLOC_CTX *_mem_save_sub_auths_0;
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_pull_align(ndr, 4));
NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->sid_rev_num));
- NDR_CHECK(ndr_pull_int8(ndr, NDR_SCALARS, &r->num_auths));
- if (r->num_auths < 0 || r->num_auths > 15) {
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->num_auths));
+ if (r->num_auths > 15) {
return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
}
NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->id_auth, 6));
- NDR_PULL_ALLOC_N(ndr, r->sub_auths, r->num_auths);
- _mem_save_sub_auths_0 = NDR_PULL_GET_MEM_CTX(ndr);
- NDR_PULL_SET_MEM_CTX(ndr, r->sub_auths, 0);
for (cntr_sub_auths_0 = 0; cntr_sub_auths_0 < r->num_auths; cntr_sub_auths_0++) {
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->sub_auths[cntr_sub_auths_0]));
}
- NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sub_auths_0, 0);
}
if (ndr_flags & NDR_BUFFERS) {
}
diff --git a/source3/libndr/unixinfo.h b/source3/libndr/unixinfo.h
new file mode 100644
index 0000000000..5d0434ca72
--- /dev/null
+++ b/source3/libndr/unixinfo.h
@@ -0,0 +1,79 @@
+/* header auto-generated by pidl */
+
+#ifndef _HEADER_unixinfo
+#define _HEADER_unixinfo
+
+struct unixinfo_GetPWUidInfo {
+ NTSTATUS status;
+ const char *homedir;/* [unique,charset(UTF8)] */
+ const char *shell;/* [unique,charset(UTF8)] */
+};
+
+
+struct unixinfo_SidToUid {
+ struct {
+ struct dom_sid sid;
+ } in;
+
+ struct {
+ uint64_t *uid;/* [ref] */
+ NTSTATUS result;
+ } out;
+
+};
+
+
+struct unixinfo_UidToSid {
+ struct {
+ uint64_t uid;
+ } in;
+
+ struct {
+ struct dom_sid *sid;/* [ref] */
+ NTSTATUS result;
+ } out;
+
+};
+
+
+struct unixinfo_SidToGid {
+ struct {
+ struct dom_sid sid;
+ } in;
+
+ struct {
+ uint64_t *gid;/* [ref] */
+ NTSTATUS result;
+ } out;
+
+};
+
+
+struct unixinfo_GidToSid {
+ struct {
+ uint64_t gid;
+ } in;
+
+ struct {
+ struct dom_sid *sid;/* [ref] */
+ NTSTATUS result;
+ } out;
+
+};
+
+
+struct unixinfo_GetPWUid {
+ struct {
+ uint32_t *count;/* [ref,range(0 1023)] */
+ uint64_t *uids;/* [size_is(*count)] */
+ } in;
+
+ struct {
+ uint32_t *count;/* [ref,range(0 1023)] */
+ struct unixinfo_GetPWUidInfo *infos;/* [ref,size_is(*count)] */
+ NTSTATUS result;
+ } out;
+
+};
+
+#endif /* _HEADER_unixinfo */
diff --git a/source3/nsswitch/winbindd_cache.c b/source3/nsswitch/winbindd_cache.c
index e93dcefc90..27d37267b5 100644
--- a/source3/nsswitch/winbindd_cache.c
+++ b/source3/nsswitch/winbindd_cache.c
@@ -215,9 +215,9 @@ static NTTIME centry_nttime(struct cache_entry *centry)
centry->len - centry->ofs));
smb_panic("centry_nttime");
}
- ret.low = IVAL(centry->data, centry->ofs);
+ ret = IVAL(centry->data, centry->ofs);
centry->ofs += 4;
- ret.high = IVAL(centry->data, centry->ofs);
+ ret += (uint64_t)IVAL(centry->data, centry->ofs) << 32;
centry->ofs += 4;
return ret;
}
@@ -685,9 +685,9 @@ static void centry_put_sid(struct cache_entry *centry, const DOM_SID *sid)
static void centry_put_nttime(struct cache_entry *centry, NTTIME nt)
{
centry_expand(centry, 8);
- SIVAL(centry->data, centry->ofs, nt.low);
+ SIVAL(centry->data, centry->ofs, nt & 0xFFFFFFFF);
centry->ofs += 4;
- SIVAL(centry->data, centry->ofs, nt.high);
+ SIVAL(centry->data, centry->ofs, nt >> 32);
centry->ofs += 4;
}
diff --git a/source3/nsswitch/winbindd_pam.c b/source3/nsswitch/winbindd_pam.c
index efdd0e874f..16e8380165 100644
--- a/source3/nsswitch/winbindd_pam.c
+++ b/source3/nsswitch/winbindd_pam.c
@@ -35,17 +35,17 @@ static NTSTATUS append_info3_as_txt(TALLOC_CTX *mem_ctx,
fstring str_sid;
state->response.data.auth.info3.logon_time =
- nt_time_to_unix(&(info3->logon_time));
+ nt_time_to_unix(info3->logon_time);
state->response.data.auth.info3.logoff_time =
- nt_time_to_unix(&(info3->logoff_time));
+ nt_time_to_unix(info3->logoff_time);
state->response.data.auth.info3.kickoff_time =
- nt_time_to_unix(&(info3->kickoff_time));
+ nt_time_to_unix(info3->kickoff_time);
state->response.data.auth.info3.pass_last_set_time =
- nt_time_to_unix(&(info3->pass_last_set_time));
+ nt_time_to_unix(info3->pass_last_set_time);
state->response.data.auth.info3.pass_can_change_time =
- nt_time_to_unix(&(info3->pass_can_change_time));
+ nt_time_to_unix(info3->pass_can_change_time);
state->response.data.auth.info3.pass_must_change_time =
- nt_time_to_unix(&(info3->pass_must_change_time));
+ nt_time_to_unix(info3->pass_must_change_time);
state->response.data.auth.info3.logon_count = info3->logon_count;
state->response.data.auth.info3.bad_pw_count = info3->bad_pw_count;
@@ -819,12 +819,12 @@ NTSTATUS winbindd_dual_pam_auth_cached(struct winbindd_domain *domain,
return NT_STATUS_LOGON_FAILURE;
}
#endif
- kickoff_time = nt_time_to_unix(&my_info3->kickoff_time);
+ kickoff_time = nt_time_to_unix(my_info3->kickoff_time);
if (kickoff_time != 0 && time(NULL) > kickoff_time) {
return NT_STATUS_ACCOUNT_EXPIRED;
}
- must_change_time = nt_time_to_unix(&my_info3->pass_must_change_time);
+ must_change_time = nt_time_to_unix(my_info3->pass_must_change_time);
if (must_change_time != 0 && must_change_time < time(NULL)) {
return NT_STATUS_PASSWORD_EXPIRED;
}
diff --git a/source3/nsswitch/winbindd_rpc.c b/source3/nsswitch/winbindd_rpc.c
index f4676cc2fe..122e2c98e0 100644
--- a/source3/nsswitch/winbindd_rpc.c
+++ b/source3/nsswitch/winbindd_rpc.c
@@ -868,7 +868,7 @@ static NTSTATUS sequence_number(struct winbindd_domain *domain, uint32 *seq)
result = rpccli_samr_query_dom_info(cli, mem_ctx, &dom_pol, 8, &ctr);
if (NT_STATUS_IS_OK(result)) {
- *seq = ctr.info.inf8.seq_num.low;
+ *seq = ctr.info.inf8.seq_num;
got_seq_num = True;
goto seq_num;
}
@@ -879,7 +879,7 @@ static NTSTATUS sequence_number(struct winbindd_domain *domain, uint32 *seq)
result = rpccli_samr_query_dom_info(cli, mem_ctx, &dom_pol, 2, &ctr);
if (NT_STATUS_IS_OK(result)) {
- *seq = ctr.info.inf2.seq_num.low;
+ *seq = ctr.info.inf2.seq_num;
got_seq_num = True;
}
diff --git a/source3/rpc_client/cli_netlogon.c b/source3/rpc_client/cli_netlogon.c
index 33f1d1d25b..85e56465b4 100644
--- a/source3/rpc_client/cli_netlogon.c
+++ b/source3/rpc_client/cli_netlogon.c
@@ -638,7 +638,7 @@ NTSTATUS rpccli_netlogon_sam_sync(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c
/* Sam synchronisation */
NTSTATUS rpccli_netlogon_sam_deltas(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
- uint32 database_id, UINT64_S seqnum,
+ uint32 database_id, uint64 seqnum,
uint32 *num_deltas,
SAM_DELTA_HDR **hdr_deltas,
SAM_DELTA_CTR **deltas)
diff --git a/source3/rpc_client/cli_reg.c b/source3/rpc_client/cli_reg.c
index 87ab5dc9da..e136df753a 100644
--- a/source3/rpc_client/cli_reg.c
+++ b/source3/rpc_client/cli_reg.c
@@ -521,7 +521,7 @@ WERROR rpccli_reg_enum_key(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
else
fstrcpy( class_name, "" );
- *mod_time = nt_time_to_unix(out.time);
+ *mod_time = nt_time_to_unix(*out.time);
return out.status;
}
diff --git a/source3/rpc_client/cli_unixinfo.c b/source3/rpc_client/cli_unixinfo.c
index b9a960dfd1..f2629bfde2 100644
--- a/source3/rpc_client/cli_unixinfo.c
+++ b/source3/rpc_client/cli_unixinfo.c
@@ -1,226 +1,105 @@
-/*
- Unix SMB/CIFS implementation.
-
- RPC pipe client
-
- Copyright (C) Volker Lendecke 2005
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
+/*
+ * Unix SMB/CIFS implementation.
+ * client auto-generated by pidl. DO NOT MODIFY!
+ */
#include "includes.h"
+#include "./cli_unixinfo.h"
-NTSTATUS rpccli_unixinfo_uid2sid(struct rpc_pipe_client *cli,
- TALLOC_CTX *mem_ctx, uid_t uid, DOM_SID *sid)
+NTSTATUS rpccli_unixinfo_SidToUid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct dom_sid sid, uint64_t *uid)
{
- prs_struct qbuf, rbuf;
- UNIXINFO_Q_UID_TO_SID q;
- UNIXINFO_R_UID_TO_SID r;
- NTSTATUS result = NT_STATUS_NET_WRITE_FAULT;
-
- ZERO_STRUCT(q);
- ZERO_STRUCT(r);
-
- /* Marshall data and send request */
- {
- UINT64_S uid64;
- uid64.high = 0;
- uid64.low = uid;
- init_q_unixinfo_uid_to_sid(&q, uid64);
+ struct unixinfo_SidToUid r;
+ NTSTATUS status;
+
+ /* In parameters */
+ r.in.sid = sid;
+ status = cli_do_rpc_ndr(cli, mem_ctx, PI_UNIXINFO, DCERPC_UNIXINFO_SIDTOUID, &r, (ndr_pull_flags_fn_t)ndr_pull_unixinfo_SidToUid, (ndr_push_flags_fn_t)ndr_push_unixinfo_SidToUid);
+ if (NT_STATUS_IS_ERR(status)) {
+ return status;
}
-
- CLI_DO_RPC(cli, mem_ctx, PI_UNIXINFO, UNIXINFO_UID_TO_SID,
- q, r,
- qbuf, rbuf,
- unixinfo_io_q_unixinfo_uid_to_sid,
- unixinfo_io_r_unixinfo_uid_to_sid,
- NT_STATUS_NET_WRITE_FAULT);
-
- if (NT_STATUS_IS_OK(r.status) && (sid != NULL)) {
- sid_copy(sid, &r.sid);
- }
-
- result = r.status;
- return result;
+
+ /* Return variables */
+ *uid = *r.out.uid;
+
+ /* Return result */
+ return r.out.result;
}
-NTSTATUS rpccli_unixinfo_sid2uid(struct rpc_pipe_client *cli,
- TALLOC_CTX *mem_ctx,
- const DOM_SID *sid, uid_t *uid)
+NTSTATUS rpccli_unixinfo_UidToSid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint64_t uid, struct dom_sid *sid)
{
- prs_struct qbuf, rbuf;
- UNIXINFO_Q_SID_TO_UID q;
- UNIXINFO_R_SID_TO_UID r;
- NTSTATUS result = NT_STATUS_NET_WRITE_FAULT;
-
- ZERO_STRUCT(q);
- ZERO_STRUCT(r);
-
- /* Marshall data and send request */
- init_q_unixinfo_sid_to_uid(&q, sid);
-
- CLI_DO_RPC(cli, mem_ctx, PI_UNIXINFO, UNIXINFO_SID_TO_UID,
- q, r,
- qbuf, rbuf,
- unixinfo_io_q_unixinfo_sid_to_uid,
- unixinfo_io_r_unixinfo_sid_to_uid,
- NT_STATUS_NET_WRITE_FAULT);
-
- if (NT_STATUS_IS_OK(r.status)) {
- if (r.uid.high != 0) {
- /* 64-Bit uid's not yet handled */
- return NT_STATUS_INVALID_PARAMETER;
- }
- if (uid != NULL) {
- *uid = r.uid.low;
- }
+ struct unixinfo_UidToSid r;
+ NTSTATUS status;
+
+ /* In parameters */
+ r.in.uid = uid;
+ status = cli_do_rpc_ndr(cli, mem_ctx, PI_UNIXINFO, DCERPC_UNIXINFO_UIDTOSID, &r, (ndr_pull_flags_fn_t)ndr_pull_unixinfo_UidToSid, (ndr_push_flags_fn_t)ndr_push_unixinfo_UidToSid);
+ if (NT_STATUS_IS_ERR(status)) {
+ return status;
}
-
- result = r.status;
- return result;
+
+ /* Return variables */
+ *sid = *r.out.sid;
+
+ /* Return result */
+ return r.out.result;
}
-NTSTATUS rpccli_unixinfo_gid2sid(struct rpc_pipe_client *cli,
- TALLOC_CTX *mem_ctx, gid_t gid, DOM_SID *sid)
+NTSTATUS rpccli_unixinfo_SidToGid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct dom_sid sid, uint64_t *gid)
{
- prs_struct qbuf, rbuf;
- UNIXINFO_Q_GID_TO_SID q;
- UNIXINFO_R_GID_TO_SID r;
- NTSTATUS result = NT_STATUS_NET_WRITE_FAULT;
-
- ZERO_STRUCT(q);
- ZERO_STRUCT(r);
-
- /* Marshall data and send request */
- {
- UINT64_S gid64;
- gid64.high = 0;
- gid64.low = gid;
- init_q_unixinfo_gid_to_sid(&q, gid64);
- }
-
- CLI_DO_RPC(cli, mem_ctx, PI_UNIXINFO, UNIXINFO_GID_TO_SID,
- q, r,
- qbuf, rbuf,
- unixinfo_io_q_unixinfo_gid_to_sid,
- unixinfo_io_r_unixinfo_gid_to_sid,
- NT_STATUS_NET_WRITE_FAULT);
-
- if (NT_STATUS_IS_OK(r.status) && (sid != NULL)) {
- sid_copy(sid, &r.sid);
+ struct unixinfo_SidToGid r;
+ NTSTATUS status;
+
+ /* In parameters */
+ r.in.sid = sid;
+ status = cli_do_rpc_ndr(cli, mem_ctx, PI_UNIXINFO, DCERPC_UNIXINFO_SIDTOGID, &r, (ndr_pull_flags_fn_t)ndr_pull_unixinfo_SidToGid, (ndr_push_flags_fn_t)ndr_push_unixinfo_SidToGid);
+ if (NT_STATUS_IS_ERR(status)) {
+ return status;
}
-
- result = r.status;
- return result;
+
+ /* Return variables */
+ *gid = *r.out.gid;
+
+ /* Return result */
+ return r.out.result;
}
-NTSTATUS rpccli_unixinfo_sid2gid(struct rpc_pipe_client *cli,
- TALLOC_CTX *mem_ctx,
- const DOM_SID *sid, gid_t *gid)
+NTSTATUS rpccli_unixinfo_GidToSid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint64_t gid, struct dom_sid *sid)
{
- prs_struct qbuf, rbuf;
- UNIXINFO_Q_SID_TO_GID q;
- UNIXINFO_R_SID_TO_GID r;
- NTSTATUS result = NT_STATUS_NET_WRITE_FAULT;
-
- ZERO_STRUCT(q);
- ZERO_STRUCT(r);
-
- /* Marshall data and send request */
- init_q_unixinfo_sid_to_gid(&q, sid);
-
- CLI_DO_RPC(cli, mem_ctx, PI_UNIXINFO, UNIXINFO_SID_TO_GID,
- q, r,
- qbuf, rbuf,
- unixinfo_io_q_unixinfo_sid_to_gid,
- unixinfo_io_r_unixinfo_sid_to_gid,
- NT_STATUS_NET_WRITE_FAULT);
-
- if (NT_STATUS_IS_OK(r.status)) {
- if (r.gid.high != 0) {
- /* 64-Bit gid's not yet handled */
- return NT_STATUS_INVALID_PARAMETER;
- }
- if (gid != NULL) {
- *gid = r.gid.low;
- }
+ struct unixinfo_GidToSid r;
+ NTSTATUS status;
+
+ /* In parameters */
+ r.in.gid = gid;
+ status = cli_do_rpc_ndr(cli, mem_ctx, PI_UNIXINFO, DCERPC_UNIXINFO_GIDTOSID, &r, (ndr_pull_flags_fn_t)ndr_pull_unixinfo_GidToSid, (ndr_push_flags_fn_t)ndr_push_unixinfo_GidToSid);
+ if (NT_STATUS_IS_ERR(status)) {
+ return status;
}
-
- result = r.status;
- return result;
+
+ /* Return variables */
+ *sid = *r.out.sid;
+
+ /* Return result */
+ return r.out.result;
}
-NTSTATUS rpccli_unixinfo_getpwuid(struct rpc_pipe_client *cli,
- TALLOC_CTX *mem_ctx,
- int count, uid_t *uids,
- struct unixinfo_getpwuid **info)
+NTSTATUS rpccli_unixinfo_GetPWUid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t *count, uint64_t *uids, struct unixinfo_GetPWUidInfo *infos)
{
- prs_struct qbuf, rbuf;
- UNIXINFO_Q_GETPWUID q;
- UNIXINFO_R_GETPWUID r;
- NTSTATUS result = NT_STATUS_NET_WRITE_FAULT;
- int i;
- UINT64_S *uids64;
-
- ZERO_STRUCT(q);
- ZERO_STRUCT(r);
-
- /* Marshall data and send request */
-
- uids64 = TALLOC_ARRAY(mem_ctx, UINT64_S, count);
- if (uids64 == NULL) {
- return NT_STATUS_NO_MEMORY;
- }
-
- for (i=0; i<count; i++) {
- uids64[i].high = 0;
- uids64[i].low = uids[i];
- }
-
- init_q_unixinfo_getpwuid(&q, count, uids64);
-
- CLI_DO_RPC(cli, mem_ctx, PI_UNIXINFO, UNIXINFO_GETPWUID,
- q, r,
- qbuf, rbuf,
- unixinfo_io_q_unixinfo_getpwuid,
- unixinfo_io_r_unixinfo_getpwuid,
- NT_STATUS_NET_WRITE_FAULT);
-
- if (!NT_STATUS_IS_OK(r.status)) {
- result = r.status;
- *info = NULL;
- return result;
- }
-
- if (r.count != count) {
- DEBUG(0, ("Expected array size %d, got %d\n",
- count, r.count));
- return NT_STATUS_INVALID_PARAMETER;
- }
-
- *info = TALLOC_ARRAY(mem_ctx, struct unixinfo_getpwuid, count);
- if (*info == NULL) {
- return NT_STATUS_NO_MEMORY;
- }
-
- for (i=0; i<count; i++) {
- (*info)[i].status = r.info[i].status;
- (*info)[i].homedir = talloc_strdup(mem_ctx, r.info[i].homedir);
- (*info)[i].shell = talloc_strdup(mem_ctx, r.info[i].shell);
+ struct unixinfo_GetPWUid r;
+ NTSTATUS status;
+
+ /* In parameters */
+ r.in.count = count;
+ r.in.uids = uids;
+ status = cli_do_rpc_ndr(cli, mem_ctx, PI_UNIXINFO, DCERPC_UNIXINFO_GETPWUID, &r, (ndr_pull_flags_fn_t)ndr_pull_unixinfo_GetPWUid, (ndr_push_flags_fn_t)ndr_push_unixinfo_GetPWUid);
+ if (NT_STATUS_IS_ERR(status)) {
+ return status;
}
-
- result = r.status;
- return result;
+
+ /* Return variables */
+ *count = *r.out.count;
+ *infos = *r.out.infos;
+
+ /* Return result */
+ return r.out.result;
}
+
diff --git a/source3/rpc_client/cli_unixinfo.h b/source3/rpc_client/cli_unixinfo.h
new file mode 100644
index 0000000000..4b3dd28c2e
--- /dev/null
+++ b/source3/rpc_client/cli_unixinfo.h
@@ -0,0 +1,9 @@
+#include "libndr/ndr_unixinfo.h"
+#ifndef __CLI_UNIXINFO__
+#define __CLI_UNIXINFO__
+NTSTATUS rpccli_unixinfo_SidToUid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct dom_sid sid, uint64_t *uid);
+NTSTATUS rpccli_unixinfo_UidToSid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint64_t uid, struct dom_sid *sid);
+NTSTATUS rpccli_unixinfo_SidToGid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct dom_sid sid, uint64_t *gid);
+NTSTATUS rpccli_unixinfo_GidToSid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint64_t gid, struct dom_sid *sid);
+NTSTATUS rpccli_unixinfo_GetPWUid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t *count, uint64_t *uids, struct unixinfo_GetPWUidInfo *infos);
+#endif /* __CLI_UNIXINFO__ */
diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c
index 532b7ccc7f..541d2d771f 100644
--- a/source3/rpc_parse/parse_misc.c
+++ b/source3/rpc_parse/parse_misc.c
@@ -115,6 +115,7 @@ static BOOL smb_io_utime(const char *desc, UTIME *t, prs_struct *ps, int depth)
BOOL smb_io_time(const char *desc, NTTIME *nttime, prs_struct *ps, int depth)
{
+ uint32 low, high;
if (nttime == NULL)
return False;
@@ -124,11 +125,13 @@ BOOL smb_io_time(const char *desc, NTTIME *nttime, prs_struct *ps, int depth)
if(!prs_align(ps))
return False;
- if(!prs_uint32("low ", ps, depth, &nttime->low)) /* low part */
+ if(!prs_uint32("low ", ps, depth, &low)) /* low part */
return False;
- if(!prs_uint32("high", ps, depth, &nttime->high)) /* high part */
+ if(!prs_uint32("high", ps, depth, &high)) /* high part */
return False;
+ *nttime = (((uint64_t)high << 32) + low);
+
return True;
}
@@ -1762,10 +1765,25 @@ BOOL smb_io_unistr3(const char *desc, UNISTR3 *name, prs_struct *ps, int depth)
/*******************************************************************
Stream a uint64_struct
********************************************************************/
-BOOL prs_uint64(const char *name, prs_struct *ps, int depth, UINT64_S *data64)
+BOOL prs_uint64(const char *name, prs_struct *ps, int depth, uint64 *data64)
{
- return prs_uint32(name, ps, depth+1, &data64->low) &&
- prs_uint32(name, ps, depth+1, &data64->high);
+ if (UNMARSHALLING(ps)) {
+ uint32 high, low;
+
+ if (!prs_uint32(name, ps, depth+1, &low))
+ return False;
+
+ if (!prs_uint32(name, ps, depth+1, &high))
+ return False;
+
+ *data64 = ((uint64_t)high << 32) + low;
+
+ return True;
+ } else {
+ uint32 high = (*data64) >> 32, low = (*data64) & 0xFFFFFFFF;
+ return prs_uint32(name, ps, depth+1, &low) &&
+ prs_uint32(name, ps, depth+1, &high);
+ }
}
/*******************************************************************
diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c
index cecec31410..5fbf9874a0 100644
--- a/source3/rpc_parse/parse_net.c
+++ b/source3/rpc_parse/parse_net.c
@@ -3104,7 +3104,7 @@ makes a NET_Q_SAM_DELTAS structure.
********************************************************************/
BOOL init_net_q_sam_deltas(NET_Q_SAM_DELTAS *q_s, const char *srv_name,
const char *cli_name, DOM_CRED *cli_creds,
- uint32 database_id, UINT64_S dom_mod_count)
+ uint32 database_id, uint64 dom_mod_count)
{
DEBUG(5, ("init_net_q_sam_deltas\n"));
@@ -3115,8 +3115,7 @@ BOOL init_net_q_sam_deltas(NET_Q_SAM_DELTAS *q_s, const char *srv_name,
memset(&q_s->ret_creds, 0, sizeof(q_s->ret_creds));
q_s->database_id = database_id;
- q_s->dom_mod_count.low = dom_mod_count.low;
- q_s->dom_mod_count.high = dom_mod_count.high;
+ q_s->dom_mod_count = dom_mod_count;
q_s->max_size = 0xffff;
return True;
diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c
index f42af48456..a8b153b9fa 100644
--- a/source3/rpc_parse/parse_samr.c
+++ b/source3/rpc_parse/parse_samr.c
@@ -511,12 +511,10 @@ void init_unk_info1(SAM_UNK_INFO_1 *u_1, uint16 min_pass_len, uint16 pass_hist,
u_1->password_properties = password_properties;
/* password never expire */
- u_1->expire.high = nt_expire.high;
- u_1->expire.low = nt_expire.low;
+ u_1->expire = nt_expire;
/* can change the password now */
- u_1->min_passwordage.high = nt_min_age.high;
- u_1->min_passwordage.low = nt_min_age.low;
+ u_1->min_passwordage = nt_min_age;
}
@@ -555,11 +553,9 @@ void init_unk_info2(SAM_UNK_INFO_2 * u_2,
const char *comment, const char *domain, const char *server,
uint32 seq_num, uint32 num_users, uint32 num_groups, uint32 num_alias, NTTIME nt_logout, uint32 server_role)
{
- u_2->logout.low = nt_logout.low;
- u_2->logout.high = nt_logout.high;
+ u_2->logout = nt_logout;
- u_2->seq_num.low = seq_num;
- u_2->seq_num.high = 0x00000000;
+ u_2->seq_num = seq_num;
u_2->unknown_4 = 0x00000001;
@@ -635,8 +631,7 @@ inits a structure.
void init_unk_info3(SAM_UNK_INFO_3 *u_3, NTTIME nt_logout)
{
- u_3->logout.low = nt_logout.low;
- u_3->logout.high = nt_logout.high;
+ u_3->logout = nt_logout;
}
/*******************************************************************
@@ -789,8 +784,7 @@ inits a structure.
void init_unk_info8(SAM_UNK_INFO_8 * u_8, uint32 seq_num)
{
unix_to_nt_time(&u_8->domain_create_time, 0);
- u_8->seq_num.low = seq_num;
- u_8->seq_num.high = 0x0000;
+ u_8->seq_num = seq_num;
}
/*******************************************************************
@@ -849,10 +843,8 @@ inits a structure.
void init_unk_info12(SAM_UNK_INFO_12 * u_12, NTTIME nt_lock_duration, NTTIME nt_reset_time, uint16 lockout)
{
- u_12->duration.low = nt_lock_duration.low;
- u_12->duration.high = nt_lock_duration.high;
- u_12->reset_count.low = nt_reset_time.low;
- u_12->reset_count.high = nt_reset_time.high;
+ u_12->duration = nt_lock_duration;
+ u_12->reset_count = nt_reset_time;
u_12->bad_attempt_lockout = lockout;
}
@@ -887,8 +879,7 @@ inits a structure.
void init_unk_info13(SAM_UNK_INFO_13 * u_13, uint32 seq_num)
{
unix_to_nt_time(&u_13->domain_create_time, 0);
- u_13->seq_num.low = seq_num;
- u_13->seq_num.high = 0x0000;
+ u_13->seq_num = seq_num;
u_13->unknown1 = 0;
u_13->unknown2 = 0;
}
diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c
index 8d4a757a74..ec64e10a59 100644
--- a/source3/rpc_parse/parse_spoolss.c
+++ b/source3/rpc_parse/parse_spoolss.c
@@ -2643,9 +2643,7 @@ BOOL smb_io_printer_driver_info_6(const char *desc, RPC_BUFFER *buffer, DRIVER_I
if (!smb_io_relarraystr("previousdrivernames", buffer, depth, &info->previousdrivernames))
return False;
- if (!prs_uint32("date.low", ps, depth, &info->driver_date.low))
- return False;
- if (!prs_uint32("date.high", ps, depth, &info->driver_date.high))
+ if (!prs_uint64("date", ps, depth, &info->driver_date))
return False;
if (!prs_uint32("padding", ps, depth, &info->padding))
diff --git a/source3/rpc_parse/parse_unixinfo.c b/source3/rpc_parse/parse_unixinfo.c
index 391713ce90..72e0d392ec 100644
--- a/source3/rpc_parse/parse_unixinfo.c
+++ b/source3/rpc_parse/parse_unixinfo.c
@@ -48,7 +48,7 @@ BOOL unixinfo_io_r_unixinfo_sid_to_uid(const char *desc, UNIXINFO_R_SID_TO_UID *
return True;
}
-void init_q_unixinfo_uid_to_sid(UNIXINFO_Q_UID_TO_SID *q_d, UINT64_S uid)
+void init_q_unixinfo_uid_to_sid(UNIXINFO_Q_UID_TO_SID *q_d, uint64 uid)
{
q_d->uid = uid;
}
@@ -97,7 +97,7 @@ BOOL unixinfo_io_q_unixinfo_sid_to_gid(const char *desc, UNIXINFO_Q_SID_TO_GID *
return smb_io_dom_sid(desc, &q_d->sid, ps, depth);
}
-void init_r_unixinfo_sid_to_gid(UNIXINFO_R_SID_TO_GID *r_d, UINT64_S gid)
+void init_r_unixinfo_sid_to_gid(UNIXINFO_R_SID_TO_GID *r_d, uint64 gid)
{
r_d->gid = gid;
r_d->status = NT_STATUS_OK;
@@ -115,7 +115,7 @@ BOOL unixinfo_io_r_unixinfo_sid_to_gid(const char *desc, UNIXINFO_R_SID_TO_GID *
return True;
}
-void init_q_unixinfo_gid_to_sid(UNIXINFO_Q_GID_TO_SID *q_d, UINT64_S gid)
+void init_q_unixinfo_gid_to_sid(UNIXINFO_Q_GID_TO_SID *q_d, uint64 gid)
{
q_d->gid = gid;
}
@@ -154,7 +154,7 @@ BOOL unixinfo_io_r_unixinfo_gid_to_sid(const char *desc, UNIXINFO_R_GID_TO_SID *
}
void init_q_unixinfo_getpwuid(UNIXINFO_Q_GETPWUID *r_d, int count,
- UINT64_S *uids)
+ uint64 *uids)
{
r_d->count = count;
r_d->uid = uids;
@@ -186,7 +186,7 @@ BOOL unixinfo_io_q_unixinfo_getpwuid(const char *desc,
}
if (UNMARSHALLING(ps)) {
- q_d->uid = PRS_ALLOC_MEM(ps, UINT64_S, q_d->count);
+ q_d->uid = PRS_ALLOC_MEM(ps, uint64, q_d->count);
if (q_d->uid == NULL) {
return False;
}
diff --git a/source3/rpc_server/srv_samr_util.c b/source3/rpc_server/srv_samr_util.c
index c4bec79c9c..4fbd9d07d2 100644
--- a/source3/rpc_server/srv_samr_util.c
+++ b/source3/rpc_server/srv_samr_util.c
@@ -76,7 +76,7 @@ void copy_id21_to_sam_passwd(struct samu *to, SAM_USER_INFO_21 *from)
return;
if (from->fields_present & ACCT_LAST_LOGON) {
- unix_time=nt_time_to_unix(&from->logon_time);
+ unix_time=nt_time_to_unix(from->logon_time);
stored_time = pdb_get_logon_time(to);
DEBUG(10,("INFO_21 LOGON_TIME: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time));
if (stored_time != unix_time)
@@ -84,7 +84,7 @@ void copy_id21_to_sam_passwd(struct samu *to, SAM_USER_INFO_21 *from)
}
if (from->fields_present & ACCT_LAST_LOGOFF) {
- unix_time=nt_time_to_unix(&from->logoff_time);
+ unix_time=nt_time_to_unix(from->logoff_time);
stored_time = pdb_get_logoff_time(to);
DEBUG(10,("INFO_21 LOGOFF_TIME: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time));
if (stored_time != unix_time)
@@ -92,7 +92,7 @@ void copy_id21_to_sam_passwd(struct samu *to, SAM_USER_INFO_21 *from)
}
if (from->fields_present & ACCT_EXPIRY) {
- unix_time=nt_time_to_unix(&from->kickoff_time);
+ unix_time=nt_time_to_unix(from->kickoff_time);
stored_time = pdb_get_kickoff_time(to);
DEBUG(10,("INFO_21 KICKOFF_TIME: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time));
if (stored_time != unix_time)
@@ -100,7 +100,7 @@ void copy_id21_to_sam_passwd(struct samu *to, SAM_USER_INFO_21 *from)
}
if (from->fields_present & ACCT_ALLOW_PWD_CHANGE) {
- unix_time=nt_time_to_unix(&from->pass_can_change_time);
+ unix_time=nt_time_to_unix(from->pass_can_change_time);
stored_time = pdb_get_pass_can_change_time(to);
DEBUG(10,("INFO_21 PASS_CAN_CH: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time));
if (stored_time != unix_time)
@@ -108,7 +108,7 @@ void copy_id21_to_sam_passwd(struct samu *to, SAM_USER_INFO_21 *from)
}
if (from->fields_present & ACCT_LAST_PWD_CHANGE) {
- unix_time=nt_time_to_unix(&from->pass_last_set_time);
+ unix_time=nt_time_to_unix(from->pass_last_set_time);
stored_time = pdb_get_pass_last_set_time(to);
DEBUG(10,("INFO_21 PASS_LAST_SET: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time));
if (stored_time != unix_time)
@@ -116,7 +116,7 @@ void copy_id21_to_sam_passwd(struct samu *to, SAM_USER_INFO_21 *from)
}
if (from->fields_present & ACCT_FORCE_PWD_CHANGE) {
- unix_time=nt_time_to_unix(&from->pass_must_change_time);
+ unix_time=nt_time_to_unix(from->pass_must_change_time);
stored_time=pdb_get_pass_must_change_time(to);
DEBUG(10,("INFO_21 PASS_MUST_CH: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time));
if (stored_time != unix_time)
@@ -324,7 +324,7 @@ void copy_id23_to_sam_passwd(struct samu *to, SAM_USER_INFO_23 *from)
return;
if (from->fields_present & ACCT_LAST_LOGON) {
- unix_time=nt_time_to_unix(&from->logon_time);
+ unix_time=nt_time_to_unix(from->logon_time);
stored_time = pdb_get_logon_time(to);
DEBUG(10,("INFO_23 LOGON_TIME: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time));
if (stored_time != unix_time)
@@ -332,7 +332,7 @@ void copy_id23_to_sam_passwd(struct samu *to, SAM_USER_INFO_23 *from)
}
if (from->fields_present & ACCT_LAST_LOGOFF) {
- unix_time=nt_time_to_unix(&from->logoff_time);
+ unix_time=nt_time_to_unix(from->logoff_time);
stored_time = pdb_get_logoff_time(to);
DEBUG(10,("INFO_23 LOGOFF_TIME: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time));
if (stored_time != unix_time)
@@ -340,7 +340,7 @@ void copy_id23_to_sam_passwd(struct samu *to, SAM_USER_INFO_23 *from)
}
if (from->fields_present & ACCT_EXPIRY) {
- unix_time=nt_time_to_unix(&from->kickoff_time);
+ unix_time=nt_time_to_unix(from->kickoff_time);
stored_time = pdb_get_kickoff_time(to);
DEBUG(10,("INFO_23 KICKOFF_TIME: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time));
if (stored_time != unix_time)
@@ -348,7 +348,7 @@ void copy_id23_to_sam_passwd(struct samu *to, SAM_USER_INFO_23 *from)
}
if (from->fields_present & ACCT_ALLOW_PWD_CHANGE) {
- unix_time=nt_time_to_unix(&from->pass_can_change_time);
+ unix_time=nt_time_to_unix(from->pass_can_change_time);
stored_time = pdb_get_pass_can_change_time(to);
DEBUG(10,("INFO_23 PASS_CAN_CH: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time));
if (stored_time != unix_time)
@@ -356,7 +356,7 @@ void copy_id23_to_sam_passwd(struct samu *to, SAM_USER_INFO_23 *from)
}
if (from->fields_present & ACCT_LAST_PWD_CHANGE) {
- unix_time=nt_time_to_unix(&from->pass_last_set_time);
+ unix_time=nt_time_to_unix(from->pass_last_set_time);
stored_time = pdb_get_pass_last_set_time(to);
DEBUG(10,("INFO_23 PASS_LAST_SET: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time));
if (stored_time != unix_time)
@@ -364,7 +364,7 @@ void copy_id23_to_sam_passwd(struct samu *to, SAM_USER_INFO_23 *from)
}
if (from->fields_present & ACCT_FORCE_PWD_CHANGE) {
- unix_time=nt_time_to_unix(&from->pass_must_change_time);
+ unix_time=nt_time_to_unix(from->pass_must_change_time);
stored_time=pdb_get_pass_must_change_time(to);
DEBUG(10,("INFO_23 PASS_MUST_CH: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time));
if (stored_time != unix_time)
@@ -562,7 +562,7 @@ void copy_id25_to_sam_passwd(struct samu *to, SAM_USER_INFO_25 *from)
return;
if (from->fields_present & ACCT_LAST_LOGON) {
- unix_time=nt_time_to_unix(&from->logon_time);
+ unix_time=nt_time_to_unix(from->logon_time);
stored_time = pdb_get_logon_time(to);
DEBUG(10,("INFO_25 LOGON_TIME: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time));
if (stored_time != unix_time)
@@ -570,7 +570,7 @@ void copy_id25_to_sam_passwd(struct samu *to, SAM_USER_INFO_25 *from)
}
if (from->fields_present & ACCT_LAST_LOGOFF) {
- unix_time=nt_time_to_unix(&from->logoff_time);
+ unix_time=nt_time_to_unix(from->logoff_time);
stored_time = pdb_get_logoff_time(to);
DEBUG(10,("INFO_25 LOGOFF_TIME: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time));
if (stored_time != unix_time)
@@ -578,7 +578,7 @@ void copy_id25_to_sam_passwd(struct samu *to, SAM_USER_INFO_25 *from)
}
if (from->fields_present & ACCT_EXPIRY) {
- unix_time=nt_time_to_unix(&from->kickoff_time);
+ unix_time=nt_time_to_unix(from->kickoff_time);
stored_time = pdb_get_kickoff_time(to);
DEBUG(10,("INFO_25 KICKOFF_TIME: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time));
if (stored_time != unix_time)
@@ -586,7 +586,7 @@ void copy_id25_to_sam_passwd(struct samu *to, SAM_USER_INFO_25 *from)
}
if (from->fields_present & ACCT_ALLOW_PWD_CHANGE) {
- unix_time=nt_time_to_unix(&from->pass_can_change_time);
+ unix_time=nt_time_to_unix(from->pass_can_change_time);
stored_time = pdb_get_pass_can_change_time(to);
DEBUG(10,("INFO_25 PASS_CAN_CH: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time));
if (stored_time != unix_time)
@@ -594,7 +594,7 @@ void copy_id25_to_sam_passwd(struct samu *to, SAM_USER_INFO_25 *from)
}
if (from->fields_present & ACCT_LAST_PWD_CHANGE) {
- unix_time=nt_time_to_unix(&from->pass_last_set_time);
+ unix_time=nt_time_to_unix(from->pass_last_set_time);
stored_time = pdb_get_pass_last_set_time(to);
DEBUG(10,("INFO_25 PASS_LAST_SET: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time));
if (stored_time != unix_time)
@@ -602,7 +602,7 @@ void copy_id25_to_sam_passwd(struct samu *to, SAM_USER_INFO_25 *from)
}
if (from->fields_present & ACCT_FORCE_PWD_CHANGE) {
- unix_time=nt_time_to_unix(&from->pass_must_change_time);
+ unix_time=nt_time_to_unix(from->pass_must_change_time);
stored_time=pdb_get_pass_must_change_time(to);
DEBUG(10,("INFO_25 PASS_MUST_CH: %lu -> %lu\n",(long unsigned int)stored_time, (long unsigned int)unix_time));
if (stored_time != unix_time)
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index 6548bf3c6d..e60a431846 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -5287,8 +5287,7 @@ static void fill_printer_driver_info_6(DRIVER_INFO_6 *info, NT_PRINTER_DRIVER_IN
info->previousdrivernames=NULL;
init_unistr_array(&info->previousdrivernames, &nullstr, servername);
- info->driver_date.low=0;
- info->driver_date.high=0;
+ info->driver_date=0;
info->padding=0;
info->driver_version_low=0;
diff --git a/source3/rpc_server/srv_unixinfo_nt.c b/source3/rpc_server/srv_unixinfo_nt.c
index 79756f20a7..2d479b42f6 100644
--- a/source3/rpc_server/srv_unixinfo_nt.c
+++ b/source3/rpc_server/srv_unixinfo_nt.c
@@ -34,12 +34,11 @@ NTSTATUS _unixinfo_sid_to_uid(pipes_struct *p,
{
uid_t uid;
- r_u->uid.low = 0;
- r_u->uid.high = 0;
+ r_u->uid = 0;
r_u->status = sid_to_uid(&q_u->sid, &uid) ? NT_STATUS_OK : NT_STATUS_NONE_MAPPED;
if (NT_STATUS_IS_OK(r_u->status))
- r_u->uid.low = uid;
+ r_u->uid = uid;
return r_u->status;
}
@@ -54,8 +53,8 @@ NTSTATUS _unixinfo_uid_to_sid(pipes_struct *p,
r_u->status = NT_STATUS_NO_SUCH_USER;
- if (q_u->uid.high == 0) {
- uid_to_sid(&sid, q_u->uid.low);
+ if (q_u->uid == 0) {
+ uid_to_sid(&sid, q_u->uid);
r_u->status = NT_STATUS_OK;
}
@@ -73,12 +72,11 @@ NTSTATUS _unixinfo_sid_to_gid(pipes_struct *p,
{
gid_t gid;
- r_u->gid.low = 0;
- r_u->gid.high = 0;
+ r_u->gid = 0;
r_u->status = sid_to_gid(&q_u->sid, &gid) ? NT_STATUS_OK : NT_STATUS_NONE_MAPPED;
if (NT_STATUS_IS_OK(r_u->status))
- r_u->gid.low = gid;
+ r_u->gid = gid;
return r_u->status;
}
@@ -93,8 +91,8 @@ NTSTATUS _unixinfo_gid_to_sid(pipes_struct *p,
r_u->status = NT_STATUS_NO_SUCH_USER;
- if (q_u->gid.high == 0) {
- gid_to_sid(&sid, q_u->gid.low);
+ if (q_u->gid == 0) {
+ gid_to_sid(&sid, q_u->gid);
r_u->status = NT_STATUS_OK;
}
@@ -135,15 +133,10 @@ NTSTATUS _unixinfo_getpwuid(pipes_struct *p,
r_u->info[i].homedir = "";
r_u->info[i].shell = "";
- if (q_u->uid[i].high != 0) {
- DEBUG(10, ("64-bit uids not yet supported...\n"));
- continue;
- }
-
- pw = getpwuid(q_u->uid[i].low);
+ pw = getpwuid(q_u->uid[i]);
if (pw == NULL) {
- DEBUG(10, ("Did not find uid %d\n", q_u->uid[i].low));
+ DEBUG(10, ("Did not find uid %lld\n", q_u->uid[i]));
continue;
}
diff --git a/source3/rpcclient/cmd_lsarpc.c b/source3/rpcclient/cmd_lsarpc.c
index 3967ed6957..4c65341740 100644
--- a/source3/rpcclient/cmd_lsarpc.c
+++ b/source3/rpcclient/cmd_lsarpc.c
@@ -63,9 +63,9 @@ static void display_query_info_1(DOM_QUERY_1 d)
{
d_printf("percent_full:\t%d\n", d.percent_full);
d_printf("log_size:\t%d\n", d.log_size);
- d_printf("retention_time:\t%08x %08x\n", d.retention_time.high, d.retention_time.low);
+ d_printf("retention_time:\t%lld\n", d.retention_time);
d_printf("shutdown_in_progress:\t%d\n", d.shutdown_in_progress);
- d_printf("time_to_shutdown:\t%08x %08x\n", d.time_to_shutdown.high, d.time_to_shutdown.low);
+ d_printf("time_to_shutdown:\t%lld\n", d.time_to_shutdown);
d_printf("next_audit_record:\t%d\n", d.next_audit_record);
d_printf("unknown:\t%d\n", d.unknown);
}
diff --git a/source3/rpcclient/cmd_netlogon.c b/source3/rpcclient/cmd_netlogon.c
index 35b8accdb6..ee0fc2e14c 100644
--- a/source3/rpcclient/cmd_netlogon.c
+++ b/source3/rpcclient/cmd_netlogon.c
@@ -263,7 +263,7 @@ static NTSTATUS cmd_netlogon_sam_deltas(struct rpc_pipe_client *cli,
uint32 database_id, num_deltas, tmp;
SAM_DELTA_HDR *hdr_deltas;
SAM_DELTA_CTR *deltas;
- UINT64_S seqnum;
+ uint64 seqnum;
if (argc != 3) {
fprintf(stderr, "Usage: %s database_id seqnum\n", argv[0]);
@@ -273,8 +273,7 @@ static NTSTATUS cmd_netlogon_sam_deltas(struct rpc_pipe_client *cli,
database_id = atoi(argv[1]);
tmp = atoi(argv[2]);
- seqnum.low = tmp & 0xffff;
- seqnum.high = 0;
+ seqnum = tmp & 0xffff;
result = rpccli_netlogon_sam_deltas(cli, mem_ctx, database_id,
seqnum, &num_deltas,
diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c
index 2aab35ea3c..8b3e3cac92 100644
--- a/source3/rpcclient/cmd_samr.c
+++ b/source3/rpcclient/cmd_samr.c
@@ -84,17 +84,17 @@ static void display_sam_user_info_21(SAM_USER_INFO_21 *usr)
printf("\tRemote Dial :\t%s\n", temp);
printf("\tLogon Time :\t%s\n",
- http_timestring(nt_time_to_unix(&usr->logon_time)));
+ http_timestring(nt_time_to_unix(usr->logon_time)));
printf("\tLogoff Time :\t%s\n",
- http_timestring(nt_time_to_unix(&usr->logoff_time)));
+ http_timestring(nt_time_to_unix(usr->logoff_time)));
printf("\tKickoff Time :\t%s\n",
- http_timestring(nt_time_to_unix(&usr->kickoff_time)));
+ http_timestring(nt_time_to_unix(usr->kickoff_time)));
printf("\tPassword last set Time :\t%s\n",
- http_timestring(nt_time_to_unix(&usr->pass_last_set_time)));
+ http_timestring(nt_time_to_unix(usr->pass_last_set_time)));
printf("\tPassword can change Time :\t%s\n",
- http_timestring(nt_time_to_unix(&usr->pass_can_change_time)));
+ http_timestring(nt_time_to_unix(usr->pass_can_change_time)));
printf("\tPassword must change Time:\t%s\n",
- http_timestring(nt_time_to_unix(&usr->pass_must_change_time)));
+ http_timestring(nt_time_to_unix(usr->pass_must_change_time)));
printf("\tunknown_2[0..31]...\n"); /* user passwords? */
@@ -114,40 +114,6 @@ static void display_sam_user_info_21(SAM_USER_INFO_21 *usr)
}
}
-static const char *display_time(NTTIME nttime)
-{
- static fstring string;
-
- float high;
- float low;
- int sec;
- int days, hours, mins, secs;
-
- if (nttime.high==0 && nttime.low==0)
- return "Now";
-
- if (nttime.high==0x80000000 && nttime.low==0)
- return "Never";
-
- high = 65536;
- high = high/10000;
- high = high*65536;
- high = high/1000;
- high = high * (~nttime.high);
-
- low = ~nttime.low;
- low = low/(1000*1000*10);
-
- sec=high+low;
-
- days=sec/(60*60*24);
- hours=(sec - (days*60*60*24)) / (60*60);
- mins=(sec - (days*60*60*24) - (hours*60*60) ) / 60;
- secs=sec - (days*60*60*24) - (hours*60*60) - (mins*60);
-
- fstr_sprintf(string, "%u days, %u hours, %u minutes, %u seconds", days, hours, mins, secs);
- return (string);
-}
static void display_password_properties(uint32 password_properties)
{
@@ -199,7 +165,7 @@ static void display_sam_unk_info_2(SAM_UNK_INFO_2 *info2)
printf("Total Groups:\t%d\n", info2->num_domain_grps);
printf("Total Aliases:\t%d\n", info2->num_local_grps);
- printf("Sequence No:\t%d\n", info2->seq_num.low);
+ printf("Sequence No:\t%lld\n", info2->seq_num);
printf("Force Logoff:\t%d\n", (int)nt_time_to_unix_abs(&info2->logout));
@@ -244,9 +210,9 @@ static void display_sam_unk_info_7(SAM_UNK_INFO_7 *info7)
static void display_sam_unk_info_8(SAM_UNK_INFO_8 *info8)
{
- printf("Sequence No:\t%d\n", info8->seq_num.low);
+ printf("Sequence No:\t%lld\n", info8->seq_num);
printf("Domain Create Time:\t%s\n",
- http_timestring(nt_time_to_unix(&info8->domain_create_time)));
+ http_timestring(nt_time_to_unix(info8->domain_create_time)));
}
static void display_sam_unk_info_9(SAM_UNK_INFO_9 *info9)
@@ -263,9 +229,9 @@ static void display_sam_unk_info_12(SAM_UNK_INFO_12 *info12)
static void display_sam_unk_info_13(SAM_UNK_INFO_13 *info13)
{
- printf("Sequence No:\t%d\n", info13->seq_num.low);
+ printf("Sequence No:\t%lld\n", info13->seq_num);
printf("Domain Create Time:\t%s\n",
- http_timestring(nt_time_to_unix(&info13->domain_create_time)));
+ http_timestring(nt_time_to_unix(info13->domain_create_time)));
printf("Unknown1:\t%d\n", info13->unknown1);
printf("Unknown2:\t%d\n", info13->unknown2);
diff --git a/source3/rpcclient/cmd_unixinfo.c b/source3/rpcclient/cmd_unixinfo.c
index 2e9ab10652..762a795bbc 100644
--- a/source3/rpcclient/cmd_unixinfo.c
+++ b/source3/rpcclient/cmd_unixinfo.c
@@ -21,6 +21,7 @@
#include "includes.h"
#include "rpcclient.h"
+#include "rpc_client/cli_unixinfo.h"
static NTSTATUS cmd_unixinfo_uid2sid(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
@@ -36,8 +37,7 @@ static NTSTATUS cmd_unixinfo_uid2sid(struct rpc_pipe_client *cli,
}
uid = atoi(argv[1]);
-
- result = rpccli_unixinfo_uid2sid(cli, mem_ctx, uid, &sid);
+ result = rpccli_unixinfo_UidToSid(cli, mem_ctx, uid, &sid);
if (!NT_STATUS_IS_OK(result))
goto done;
@@ -52,7 +52,7 @@ static NTSTATUS cmd_unixinfo_sid2uid(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
int argc, const char **argv)
{
- uid_t uid;
+ uint64_t uid;
DOM_SID sid;
NTSTATUS result;
@@ -66,12 +66,12 @@ static NTSTATUS cmd_unixinfo_sid2uid(struct rpc_pipe_client *cli,
goto done;
}
- result = rpccli_unixinfo_sid2uid(cli, mem_ctx, &sid, &uid);
+ result = rpccli_unixinfo_SidToUid(cli, mem_ctx, sid, &uid);
if (!NT_STATUS_IS_OK(result))
goto done;
- printf("%u\n", uid);
+ printf("%llu\n", uid);
done:
return result;
@@ -92,7 +92,7 @@ static NTSTATUS cmd_unixinfo_gid2sid(struct rpc_pipe_client *cli,
gid = atoi(argv[1]);
- result = rpccli_unixinfo_gid2sid(cli, mem_ctx, gid, &sid);
+ result = rpccli_unixinfo_GidToSid(cli, mem_ctx, gid, &sid);
if (!NT_STATUS_IS_OK(result))
goto done;
@@ -107,7 +107,7 @@ static NTSTATUS cmd_unixinfo_sid2gid(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
int argc, const char **argv)
{
- gid_t gid;
+ uint64_t gid;
DOM_SID sid;
NTSTATUS result;
@@ -121,12 +121,12 @@ static NTSTATUS cmd_unixinfo_sid2gid(struct rpc_pipe_client *cli,
goto done;
}
- result = rpccli_unixinfo_sid2gid(cli, mem_ctx, &sid, &gid);
+ result = rpccli_unixinfo_SidToGid(cli, mem_ctx, sid, &gid);
if (!NT_STATUS_IS_OK(result))
goto done;
- printf("%u\n", gid);
+ printf("%llu\n", gid);
done:
return result;
@@ -136,9 +136,9 @@ static NTSTATUS cmd_unixinfo_getpwuid(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
int argc, const char **argv)
{
- uid_t *uids;
- int i, num_uids;
- struct unixinfo_getpwuid *info;
+ uint64_t *uids;
+ unsigned int i, num_uids;
+ struct unixinfo_GetPWUidInfo *info;
NTSTATUS result;
if (argc < 2) {
@@ -147,7 +147,7 @@ static NTSTATUS cmd_unixinfo_getpwuid(struct rpc_pipe_client *cli,
}
num_uids = argc-1;
- uids = TALLOC_ARRAY(mem_ctx, uid_t, num_uids);
+ uids = TALLOC_ARRAY(mem_ctx, uint64_t, num_uids);
if (uids == NULL) {
return NT_STATUS_NO_MEMORY;
@@ -157,7 +157,7 @@ static NTSTATUS cmd_unixinfo_getpwuid(struct rpc_pipe_client *cli,
uids[i] = atoi(argv[i+1]);
}
- result = rpccli_unixinfo_getpwuid(cli, mem_ctx, num_uids, uids, &info);
+ result = rpccli_unixinfo_GetPWUid(cli, mem_ctx, &num_uids, uids, &info);
if (!NT_STATUS_IS_OK(result)) {
return result;
@@ -165,10 +165,10 @@ static NTSTATUS cmd_unixinfo_getpwuid(struct rpc_pipe_client *cli,
for (i=0; i<num_uids; i++) {
if (NT_STATUS_IS_OK(info[i].status)) {
- printf("%d:%s:%s\n", uids[i], info[i].homedir,
+ printf("%llu:%s:%s\n", uids[i], info[i].homedir,
info[i].shell);
} else {
- printf("%d:%s\n", uids[i], nt_errstr(info[i].status));
+ printf("%llu:%s\n", uids[i], nt_errstr(info[i].status));
}
}
diff --git a/source3/script/tests/test_posix_s3.sh b/source3/script/tests/test_posix_s3.sh
index 63382b3fbb..bace1e5295 100755
--- a/source3/script/tests/test_posix_s3.sh
+++ b/source3/script/tests/test_posix_s3.sh
@@ -35,6 +35,7 @@ raw="$raw RAW-SAMBA3HIDE RAW-SAMBA3BADPATH"
rpc="RPC-AUTHCONTEXT RPC-BINDSAMBA3 RPC-NETLOGSAMBA3 RPC-SAMBA3SESSIONKEY"
rpc="$rpc RPC-SAMBA3-SRVSVC RPC-SAMBA3-GETUSERNAME RPC-SAMBA3-SHARESEC"
+rpc="$rpc RPC-UNIXINFO"
tests="$base $raw $rpc"
diff --git a/source3/torture/msgtest.c b/source3/torture/msgtest.c
index 0c7b57f80c..e8db20f4a8 100644
--- a/source3/torture/msgtest.c
+++ b/source3/torture/msgtest.c
@@ -26,23 +26,6 @@
static int pong_count;
-/* samba4 timeval functions */
-
-double timeval_elapsed2(const struct timeval *tv1, const struct timeval *tv2)
-{
- return (tv2->tv_sec - tv1->tv_sec) +
- (tv2->tv_usec - tv1->tv_usec)*1.0e-6;
-}
-
-/**
- return the number of seconds elapsed since a given time
-*/
-double timeval_elapsed(const struct timeval *tv)
-{
- struct timeval tv2 = timeval_current();
- return timeval_elapsed2(tv, &tv2);
-}
-
/****************************************************************************
a useful function for testing the message system
****************************************************************************/
diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c
index f2cd4adb17..e0c361822d 100644
--- a/source3/utils/net_rpc.c
+++ b/source3/utils/net_rpc.c
@@ -462,7 +462,7 @@ NTSTATUS rpc_info_internals(const DOM_SID *domain_sid,
TALLOC_CTX *ctx = talloc_init("rpc_info_internals");
d_printf("Domain Name: %s\n", unistr2_tdup(ctx, &ctr.info.inf2.uni_domain));
d_printf("Domain SID: %s\n", sid_str);
- d_printf("Sequence number: %u\n", ctr.info.inf2.seq_num.low);
+ d_printf("Sequence number: %llu\n", ctr.info.inf2.seq_num);
d_printf("Num users: %u\n", ctr.info.inf2.num_domain_usrs);
d_printf("Num domain groups: %u\n", ctr.info.inf2.num_domain_grps);
d_printf("Num local groups: %u\n", ctr.info.inf2.num_local_grps);
diff --git a/source3/utils/net_rpc_samsync.c b/source3/utils/net_rpc_samsync.c
index bbe09a3b35..0b54a6c97f 100644
--- a/source3/utils/net_rpc_samsync.c
+++ b/source3/utils/net_rpc_samsync.c
@@ -42,44 +42,6 @@ static void display_group_mem_info(uint32 rid, SAM_GROUP_MEM_INFO *g)
d_printf("\n");
}
-static const char *display_time(const UINT64_S *nttime)
-{
- static fstring string;
-
- float high;
- float low;
- int sec;
- int days, hours, mins, secs;
- int offset = 1;
-
- if (nttime->high==0 && nttime->low==0)
- return "Now";
-
- if (nttime->high==0x80000000 && nttime->low==0)
- return "Never";
-
- high = 65536;
- high = high/10000;
- high = high*65536;
- high = high/1000;
- high = high * (~nttime->high);
-
- low = ~nttime->low;
- low = low/(1000*1000*10);
-
- sec=high+low;
- sec+=offset;
-
- days=sec/(60*60*24);
- hours=(sec - (days*60*60*24)) / (60*60);
- mins=(sec - (days*60*60*24) - (hours*60*60) ) / 60;
- secs=sec - (days*60*60*24) - (hours*60*60) - (mins*60);
-
- fstr_sprintf(string, "%u days, %u hours, %u minutes, %u seconds", days, hours, mins, secs);
- return (string);
-}
-
-
static void display_alias_info(uint32 rid, SAM_ALIAS_INFO *a)
{
d_printf("Alias '%s' ", unistr2_static(&a->uni_als_name));
@@ -123,11 +85,10 @@ static void display_account_info(uint32 rid, SAM_ACCOUNT_INFO *a)
pdb_encode_acct_ctrl(a->acb_info, NEW_PW_FORMAT_SPACE_PADDED_LEN));
}
-static time_t uint64s_nt_time_to_unix_abs(const UINT64_S *src)
+static time_t uint64s_nt_time_to_unix_abs(const uint64 *src)
{
NTTIME nttime;
- nttime.high = src->high;
- nttime.low = src->low;
+ nttime = *src;
return nt_time_to_unix_abs(&nttime);
}
@@ -144,11 +105,11 @@ static void display_domain_info(SAM_DOMAIN_INFO *a)
d_printf("Force Logoff: %d\n", (int)u_logout);
- d_printf("Max Password Age: %s\n", display_time(&a->max_pwd_age));
- d_printf("Min Password Age: %s\n", display_time(&a->min_pwd_age));
+ d_printf("Max Password Age: %s\n", display_time(a->max_pwd_age));
+ d_printf("Min Password Age: %s\n", display_time(a->min_pwd_age));
- d_printf("Lockout Time: %s\n", display_time(&a->account_lockout.lockout_duration));
- d_printf("Lockout Reset Time: %s\n", display_time(&a->account_lockout.reset_count));
+ d_printf("Lockout Time: %s\n", display_time(a->account_lockout.lockout_duration));
+ d_printf("Lockout Reset Time: %s\n", display_time(a->account_lockout.reset_count));
d_printf("Bad Attempt Lockout: %d\n", a->account_lockout.bad_attempt_lockout);
d_printf("User must logon to change password: %d\n", a->logon_chgpass);
@@ -420,14 +381,14 @@ static NTSTATUS sam_account_from_delta(struct samu *account, SAM_ACCOUNT_INFO *d
/* Logon and password information */
if (!nt_time_is_zero(&delta->logon_time)) {
- unix_time = nt_time_to_unix(&delta->logon_time);
+ unix_time = nt_time_to_unix(delta->logon_time);
stored_time = pdb_get_logon_time(account);
if (stored_time != unix_time)
pdb_set_logon_time(account, unix_time, PDB_CHANGED);
}
if (!nt_time_is_zero(&delta->logoff_time)) {
- unix_time = nt_time_to_unix(&delta->logoff_time);
+ unix_time = nt_time_to_unix(delta->logoff_time);
stored_time = pdb_get_logoff_time(account);
if (stored_time != unix_time)
pdb_set_logoff_time(account, unix_time,PDB_CHANGED);
@@ -463,7 +424,7 @@ static NTSTATUS sam_account_from_delta(struct samu *account, SAM_ACCOUNT_INFO *d
pdb_set_logon_count(account, delta->logon_count, PDB_CHANGED);
if (!nt_time_is_zero(&delta->pwd_last_set_time)) {
- unix_time = nt_time_to_unix(&delta->pwd_last_set_time);
+ unix_time = nt_time_to_unix(delta->pwd_last_set_time);
stored_time = pdb_get_pass_last_set_time(account);
if (stored_time != unix_time)
pdb_set_pass_last_set_time(account, unix_time, PDB_CHANGED);
@@ -1632,7 +1593,7 @@ static NTSTATUS fetch_account_info_to_ldif(SAM_DELTA_CTR *delta,
} else {
pdb_sethexpwd(hex_nt_passwd, NULL, 0);
}
- unix_time = nt_time_to_unix(&(delta->account_info.pwd_last_set_time));
+ unix_time = nt_time_to_unix(delta->account_info.pwd_last_set_time);
/* The nobody user is entered by populate_ldap_for_ldif */
if (strcmp(username, "nobody") == 0) {