summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/auth/auth_sam.c10
-rw-r--r--source4/build/m4/rewrite.m42
-rw-r--r--source4/build/pidl/util.pm2
-rw-r--r--source4/client/client.c12
-rw-r--r--source4/client/clitar.c22
-rw-r--r--source4/include/byteorder.h4
-rw-r--r--source4/include/client.h2
-rw-r--r--source4/include/context.h4
-rw-r--r--source4/include/includes.h41
-rw-r--r--source4/include/nameserv.h4
-rw-r--r--source4/include/smb_interfaces.h182
-rw-r--r--source4/lib/fsusage.c18
-rw-r--r--source4/lib/ldb/common/ldb_msg.c22
-rw-r--r--source4/lib/registry/reg_backend_nt4/reg_backend_nt4.c3
-rw-r--r--source4/lib/system.c30
-rw-r--r--source4/lib/time.c99
-rw-r--r--source4/libcli/clilist.c6
-rw-r--r--source4/libcli/clitrans2.c16
-rw-r--r--source4/libcli/raw/clispnego.c12
-rw-r--r--source4/libcli/raw/rawnegotiate.c2
-rw-r--r--source4/libcli/raw/rawrequest.c10
-rw-r--r--source4/libcli/raw/rawsetfileinfo.c14
-rw-r--r--source4/libcli/util/asn1.c12
-rw-r--r--source4/libcli/util/smbencrypt.c2
-rw-r--r--source4/librpc/idl/misc.idl6
-rw-r--r--source4/librpc/idl/netlogon.idl14
-rw-r--r--source4/librpc/idl/samr.idl17
-rw-r--r--source4/librpc/ndr/ndr_basic.c77
-rw-r--r--source4/ntvfs/ntvfs_generic.c24
-rw-r--r--source4/ntvfs/simple/svfs_util.c4
-rw-r--r--source4/rpc_server/echo/rpc_echo.c9
-rw-r--r--source4/rpc_server/netlogon/dcerpc_netlogon.c3
-rw-r--r--source4/rpc_server/samr/dcesrv_samr.c4
-rw-r--r--source4/rpc_server/samr/samdb.c105
-rw-r--r--source4/rpc_server/samr/samr_password.c224
-rw-r--r--source4/smb_server/negprot.c8
-rw-r--r--source4/smb_server/reply.c41
-rw-r--r--source4/smb_server/trans2.c66
-rw-r--r--source4/torture/gentest.c8
-rw-r--r--source4/torture/locktest.c6
-rw-r--r--source4/torture/raw/close.c4
-rw-r--r--source4/torture/raw/open.c8
-rw-r--r--source4/torture/raw/qfileinfo.c36
-rw-r--r--source4/torture/raw/read.c8
-rw-r--r--source4/torture/raw/search.c10
-rw-r--r--source4/torture/raw/setfileinfo.c6
-rw-r--r--source4/torture/raw/write.c12
-rw-r--r--source4/torture/rpc/netlogon.c18
-rw-r--r--source4/torture/rpc/samr.c4
-rw-r--r--source4/torture/torture_util.c10
50 files changed, 707 insertions, 556 deletions
diff --git a/source4/auth/auth_sam.c b/source4/auth/auth_sam.c
index 1c33b26528..549b5ab362 100644
--- a/source4/auth/auth_sam.c
+++ b/source4/auth/auth_sam.c
@@ -91,28 +91,28 @@ static NTSTATUS sam_account_ok(TALLOC_CTX *mem_ctx,
/* Test account expire time */
- if (!nt_time_is_zero(acct_expiry) && time(NULL) > nt_time_to_unix(acct_expiry)) {
+ if ((*acct_expiry) != 0 && time(NULL) > nt_time_to_unix(*acct_expiry)) {
DEBUG(1,("sam_account_ok: Account for user '%s' has expired.\n", username));
DEBUG(3,("sam_account_ok: Account expired at '%s'.\n",
- nt_time_string(mem_ctx, acct_expiry)));
+ nt_time_string(mem_ctx, *acct_expiry)));
return NT_STATUS_ACCOUNT_EXPIRED;
}
if (!(acct_flags & ACB_PWNOEXP)) {
/* check for immediate expiry "must change at next logon" */
- if (nt_time_is_zero(must_change_time) && !nt_time_is_zero(last_set_time)) {
+ if (*must_change_time == 0 && *last_set_time != 0) {
DEBUG(1,("sam_account_ok: Account for user '%s' password must change!.\n",
username));
return NT_STATUS_PASSWORD_MUST_CHANGE;
}
/* check for expired password */
- if (!nt_time_is_zero(must_change_time) && nt_time_to_unix(must_change_time) < time(NULL)) {
+ if ((*must_change_time) != 0 && nt_time_to_unix(*must_change_time) < time(NULL)) {
DEBUG(1,("sam_account_ok: Account for user '%s' password expired!.\n",
username));
DEBUG(1,("sam_account_ok: Password expired at '%s' unix time.\n",
- nt_time_string(mem_ctx, must_change_time)));
+ nt_time_string(mem_ctx, *must_change_time)));
return NT_STATUS_PASSWORD_EXPIRED;
}
}
diff --git a/source4/build/m4/rewrite.m4 b/source4/build/m4/rewrite.m4
index 0df2b7b65c..8ea87e9fa4 100644
--- a/source4/build/m4/rewrite.m4
+++ b/source4/build/m4/rewrite.m4
@@ -364,6 +364,8 @@ AC_CHECK_TYPE(offset_t,loff_t)
AC_CHECK_TYPE(ssize_t, int)
AC_CHECK_TYPE(wchar_t, unsigned short)
AC_CHECK_TYPE(uint_t, unsigned int)
+AC_CHECK_TYPE(int64_t, long long)
+AC_CHECK_TYPE(uint64_t, unsigned long long)
############################################
# we need dlopen/dlclose/dlsym/dlerror for PAM, the password database plugins and the plugin loading code
diff --git a/source4/build/pidl/util.pm b/source4/build/pidl/util.pm
index d09347f22d..f822222b45 100644
--- a/source4/build/pidl/util.pm
+++ b/source4/build/pidl/util.pm
@@ -172,7 +172,7 @@ sub is_scalar_type($)
{
my($type) = shift;
- if ($type =~ /uint\d+/) {
+ if ($type =~ /^u?int\d+/) {
return 1;
}
if ($type =~ /char|short|long|NTTIME|
diff --git a/source4/client/client.c b/source4/client/client.c
index dcb1c7c418..77d4b4b497 100644
--- a/source4/client/client.c
+++ b/source4/client/client.c
@@ -83,9 +83,9 @@ static BOOL abort_mget = True;
static pstring fileselection = "";
/* timing globals */
-SMB_BIG_UINT get_total_size = 0;
+uint64_t get_total_size = 0;
unsigned int get_total_time_ms = 0;
-static SMB_BIG_UINT put_total_size = 0;
+static uint64_t put_total_size = 0;
static unsigned int put_total_time_ms = 0;
/* totals globals */
@@ -1663,10 +1663,10 @@ static int cmd_allinfo(void)
goto done;
}
- d_printf("\tcreate_time: %s\n", nt_time_string(mem_ctx, &finfo.all_info.out.create_time));
- d_printf("\taccess_time: %s\n", nt_time_string(mem_ctx, &finfo.all_info.out.access_time));
- d_printf("\twrite_time: %s\n", nt_time_string(mem_ctx, &finfo.all_info.out.write_time));
- d_printf("\tchange_time: %s\n", nt_time_string(mem_ctx, &finfo.all_info.out.change_time));
+ d_printf("\tcreate_time: %s\n", nt_time_string(mem_ctx, finfo.all_info.out.create_time));
+ d_printf("\taccess_time: %s\n", nt_time_string(mem_ctx, finfo.all_info.out.access_time));
+ d_printf("\twrite_time: %s\n", nt_time_string(mem_ctx, finfo.all_info.out.write_time));
+ d_printf("\tchange_time: %s\n", nt_time_string(mem_ctx, finfo.all_info.out.change_time));
d_printf("\tattrib: 0x%x\n", finfo.all_info.out.attrib);
d_printf("\talloc_size: %lu\n", (unsigned long)finfo.all_info.out.alloc_size);
d_printf("\tsize: %lu\n", (unsigned long)finfo.all_info.out.size);
diff --git a/source4/client/clitar.c b/source4/client/clitar.c
index cd3c9f2310..09f10edee7 100644
--- a/source4/client/clitar.c
+++ b/source4/client/clitar.c
@@ -45,7 +45,7 @@ typedef struct file_info_struct file_info2;
struct file_info_struct
{
- SMB_BIG_UINT size;
+ uint64_t size;
uint16 mode;
uid_t uid;
gid_t gid;
@@ -120,11 +120,11 @@ extern int get_total_size;
static int blocksize=20;
static int tarhandle;
-static void writetarheader(int f, const char *aname, SMB_BIG_UINT size, time_t mtime,
+static void writetarheader(int f, const char *aname, uint64_t size, time_t mtime,
const char *amode, unsigned char ftype);
static void do_atar(char *rname,char *lname,file_info *finfo1);
static void do_tar(file_info *finfo);
-static void oct_it(SMB_BIG_UINT value, int ndgs, char *p);
+static void oct_it(uint64_t value, int ndgs, char *p);
static void fixtarname(char *tptr, const char *fp, int l);
static int dotarbuf(int f, char *b, int n);
static void dozerobuf(int f, int n);
@@ -163,7 +163,7 @@ static char *string_create_s(int size)
/****************************************************************************
Write a tar header to buffer
****************************************************************************/
-static void writetarheader(int f, const char *aname, SMB_BIG_UINT size, time_t mtime,
+static void writetarheader(int f, const char *aname, uint64_t size, time_t mtime,
const char *amode, unsigned char ftype)
{
union hblock hb;
@@ -202,17 +202,17 @@ static void writetarheader(int f, const char *aname, SMB_BIG_UINT size, time_t m
hb.dbuf.name[NAMSIZ-1]='\0';
safe_strcpy(hb.dbuf.mode, amode, strlen(amode));
- oct_it((SMB_BIG_UINT)0, 8, hb.dbuf.uid);
- oct_it((SMB_BIG_UINT)0, 8, hb.dbuf.gid);
- oct_it((SMB_BIG_UINT) size, 13, hb.dbuf.size);
- oct_it((SMB_BIG_UINT) mtime, 13, hb.dbuf.mtime);
+ oct_it((uint64_t)0, 8, hb.dbuf.uid);
+ oct_it((uint64_t)0, 8, hb.dbuf.gid);
+ oct_it((uint64_t) size, 13, hb.dbuf.size);
+ oct_it((uint64_t) mtime, 13, hb.dbuf.mtime);
memcpy(hb.dbuf.chksum, " ", sizeof(hb.dbuf.chksum));
memset(hb.dbuf.linkname, 0, NAMSIZ);
hb.dbuf.linkflag=ftype;
for (chk=0, i=sizeof(hb.dummy), jp=hb.dummy; --i>=0;) chk+=(0xFF & *jp++);
- oct_it((SMB_BIG_UINT) chk, 8, hb.dbuf.chksum);
+ oct_it((uint64_t) chk, 8, hb.dbuf.chksum);
hb.dbuf.chksum[6] = '\0';
(void) dotarbuf(f, hb.dummy, sizeof(hb.dummy));
@@ -426,7 +426,7 @@ static void fixtarname(char *tptr, const char *fp, int l)
/****************************************************************************
Convert from decimal to octal string
****************************************************************************/
-static void oct_it (SMB_BIG_UINT value, int ndgs, char *p)
+static void oct_it (uint64_t value, int ndgs, char *p)
{
/* Converts long to octal string, pads with leading zeros */
@@ -598,7 +598,7 @@ append one remote file to the tar file
static void do_atar(char *rname,char *lname,file_info *finfo1)
{
int fnum;
- SMB_BIG_UINT nread=0;
+ uint64_t nread=0;
char ftype;
file_info2 finfo;
BOOL close_done = False;
diff --git a/source4/include/byteorder.h b/source4/include/byteorder.h
index 94a346f89d..48b4cb8127 100644
--- a/source4/include/byteorder.h
+++ b/source4/include/byteorder.h
@@ -172,4 +172,8 @@ it also defines lots of intermediate macros, just ignore those :-)
/* macros for accessing SMB protocol elements */
#define VWV(vwv) ((vwv)*2)
+/* 64 bit macros */
+#define SBVAL(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), SIVAL(p,(ofs)+4,(v)>>32))
+#define BVAL(p, ofs) (IVAL(p,ofs) | (((uint64_t)IVAL(p,(ofs)+4)) << 32))
+
#endif /* _BYTEORDER_H */
diff --git a/source4/include/client.h b/source4/include/client.h
index 8b0aedd48c..0750ff4363 100644
--- a/source4/include/client.h
+++ b/source4/include/client.h
@@ -40,7 +40,7 @@
typedef struct file_info
{
- SMB_BIG_UINT size;
+ uint64_t size;
uint16 mode;
uid_t uid;
gid_t gid;
diff --git a/source4/include/context.h b/source4/include/context.h
index e533c6d243..188f567e00 100644
--- a/source4/include/context.h
+++ b/source4/include/context.h
@@ -115,7 +115,7 @@ struct request_context {
unsigned chain_count;
/* the sequence number for signing */
- large_t seq_num;
+ uint64_t seq_num;
/* the async structure allows backend functions to delay
replying to requests. To use this, the front end must set
@@ -335,7 +335,7 @@ struct timers_context {
struct signing_context {
DATA_BLOB mac_key;
- large_t next_seq_num;
+ uint64_t next_seq_num;
enum smb_signing_state signing_state;
};
diff --git a/source4/include/includes.h b/source4/include/includes.h
index 1037d54c4e..b6be02155e 100644
--- a/source4/include/includes.h
+++ b/source4/include/includes.h
@@ -499,6 +499,14 @@ typedef int socklen_t;
#endif
#endif
+#if !defined(uint64)
+#define uint64 uint64_t
+#endif
+
+#if !defined(int64)
+#define int64 int64_t
+#endif
+
/*
* Types for devices, inodes and offsets.
*/
@@ -543,11 +551,6 @@ typedef int socklen_t;
# endif
#endif
-/* this should really be a 64 bit type if possible */
-#define br_off SMB_BIG_UINT
-
-#define SMB_OFF_T_BITS (sizeof(SMB_OFF_T)*8)
-
/*
* Set the define that tells us if we can do 64 bit
* NT SMB calls.
@@ -559,20 +562,6 @@ typedef int socklen_t;
# endif
#endif
-#ifdef LARGE_SMB_OFF_T
-#define SOFF_T(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), SIVAL(p,(ofs)+4,(v)>>32))
-#define SOFF_T_R(p, ofs, v) (SIVAL(p,(ofs)+4,(v)&0xFFFFFFFF), SIVAL(p,ofs,(v)>>32))
-#define IVAL_TO_SMB_OFF_T(buf,off) ((SMB_OFF_T)(( ((SMB_BIG_UINT)(IVAL((buf),(off)))) & ((SMB_BIG_UINT)0xFFFFFFFF) )))
-#define IVAL2_TO_SMB_BIG_UINT(buf,off) ( (((SMB_BIG_UINT)(IVAL((buf),(off)))) & ((SMB_BIG_UINT)0xFFFFFFFF)) | \
- (( ((SMB_BIG_UINT)(IVAL((buf),(off+4)))) & ((SMB_BIG_UINT)0xFFFFFFFF) ) << 32 ) )
-#else
-#define SOFF_T(p, ofs, v) (SIVAL(p,ofs,v),SIVAL(p,(ofs)+4,0))
-#define SOFF_T_R(p, ofs, v) (SIVAL(p,(ofs)+4,v),SIVAL(p,ofs,0))
-#define IVAL_TO_SMB_OFF_T(buf,off) ((SMB_OFF_T)(( ((uint32)(IVAL((buf),(off)))) & 0xFFFFFFFF )))
-#define IVAL2_TO_SMB_BIG_UINT(buf,off) ( (((SMB_BIG_UINT)(IVAL((buf),(off)))) & ((SMB_BIG_UINT)0xFFFFFFFF)) | \
- (( ((SMB_BIG_UINT)(IVAL((buf),(off+4)))) & ((SMB_BIG_UINT)0xFFFFFFFF) ) << 32 ) )
-#endif
-
/*
* Type for stat structure.
*/
@@ -633,20 +622,6 @@ typedef int socklen_t;
# endif
#endif
-#if defined(HAVE_LONGLONG)
-#define SMB_BIG_UINT unsigned long long
-#define SMB_BIG_INT long long
-#define SBVAL(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), SIVAL(p,(ofs)+4,(v)>>32))
-#define BVAL(p, ofs) (IVAL(p,ofs) | (((SMB_BIG_UINT)IVAL(p,(ofs)+4)) << 32))
-#else
-#define SMB_BIG_UINT unsigned long
-#define SMB_BIG_INT long
-#define SBVAL(p, ofs, v) (SIVAL(p,ofs,v),SIVAL(p,(ofs)+4,0))
-#define BVAL(p, ofs) IVAL(p,ofs)
-#endif
-
-#define SMB_BIG_UINT_BITS (sizeof(SMB_BIG_UINT)*8)
-
#ifndef MIN
#define MIN(a,b) ((a)<(b)?(a):(b))
#endif
diff --git a/source4/include/nameserv.h b/source4/include/nameserv.h
index 7611fdfb8d..9098477445 100644
--- a/source4/include/nameserv.h
+++ b/source4/include/nameserv.h
@@ -213,7 +213,7 @@ struct nmb_data
time_t death_time; /* The time the record must be removed (do not remove if 0). */
time_t refresh_time; /* The time the record should be refreshed. */
- SMB_BIG_UINT id; /* unique id */
+ uint64_t id; /* unique id */
struct in_addr wins_ip; /* the adress of the wins server this record comes from */
int wins_flags; /* similar to the netbios flags but different ! */
@@ -633,7 +633,7 @@ typedef struct _WINS_RECORD {
char type;
int nb_flags;
int wins_flags;
- SMB_BIG_UINT id;
+ uint64_t id;
int num_ips;
struct in_addr ip[25];
struct in_addr wins_ip;
diff --git a/source4/include/smb_interfaces.h b/source4/include/smb_interfaces.h
index 1f6208cdb5..73ee9e2e22 100644
--- a/source4/include/smb_interfaces.h
+++ b/source4/include/smb_interfaces.h
@@ -20,24 +20,14 @@
*/
-typedef SMB_BIG_UINT large_t;
-
/* Globally Unique ID */
#define GUID_SIZE 16
/* 64 bit time (100 nanosec) 1601 - cifs6.txt, section 3.5, page 30 */
-typedef struct nttime_info
-{
- uint32 low;
- uint32 high;
-} NTTIME;
+typedef uint64_t NTTIME;
/* 8 byte aligned 'hyper' type from MS IDL */
-typedef struct
-{
- uint32 low;
- uint32 high;
-} HYPER_T;
+typedef uint64_t HYPER_T;
@@ -376,28 +366,28 @@ union smb_fileinfo {
NTTIME write_time;
NTTIME change_time;
uint32 ex_attrib;
- large_t alloc_size;
- large_t size;
+ uint64_t alloc_size;
+ uint64_t size;
uint32 nlink;
WIRE_STRING fname;
WIRE_STRING alt_fname;
uint8 delete_pending;
uint8 directory;
- large_t compressed_size;
+ uint64_t compressed_size;
uint16 format;
uint8 unit_shift;
uint8 chunk_shift;
uint8 cluster_shift;
- large_t file_id;
+ uint64_t file_id;
uint32 access_flags; /* seen 0x001f01ff from w2k3 */
- large_t position;
+ uint64_t position;
uint32 mode;
uint32 alignment_requirement;
uint32 reparse_tag;
uint_t num_streams;
struct stream_struct {
- large_t size;
- large_t alloc_size;
+ uint64_t size;
+ uint64_t alloc_size;
WIRE_STRING stream_name;
} *streams;
} out;
@@ -503,8 +493,8 @@ union smb_fileinfo {
union smb_fileinfo_in in;
struct {
- large_t alloc_size;
- large_t size;
+ uint64_t alloc_size;
+ uint64_t size;
uint32 nlink;
BOOL delete_pending;
BOOL directory;
@@ -542,8 +532,8 @@ union smb_fileinfo {
NTTIME write_time;
NTTIME change_time;
uint32 attrib;
- large_t alloc_size;
- large_t size;
+ uint64_t alloc_size;
+ uint64_t size;
uint32 nlink;
uint8 delete_pending;
uint8 directory;
@@ -579,7 +569,7 @@ union smb_fileinfo {
union smb_fileinfo_in in;
struct {
- large_t compressed_size;
+ uint64_t compressed_size;
uint16 format;
uint8 unit_shift;
uint8 chunk_shift;
@@ -593,19 +583,19 @@ union smb_fileinfo {
union smb_fileinfo_in in;
struct {
- large_t end_of_file;
- large_t num_bytes;
+ uint64_t end_of_file;
+ uint64_t num_bytes;
NTTIME status_change_time;
NTTIME access_time;
NTTIME change_time;
- large_t uid;
- large_t gid;
+ uint64_t uid;
+ uint64_t gid;
uint32 file_type;
- large_t dev_major;
- large_t dev_minor;
- large_t unique_id;
- large_t permissions;
- large_t nlink;
+ uint64_t dev_major;
+ uint64_t dev_minor;
+ uint64_t unique_id;
+ uint64_t permissions;
+ uint64_t nlink;
} out;
} unix_basic_info;
@@ -625,7 +615,7 @@ union smb_fileinfo {
union smb_fileinfo_in in;
struct {
- large_t file_id;
+ uint64_t file_id;
} out;
} internal_information;
@@ -645,7 +635,7 @@ union smb_fileinfo {
union smb_fileinfo_in in;
struct {
- large_t position;
+ uint64_t position;
} out;
} position_information;
@@ -679,8 +669,8 @@ union smb_fileinfo {
NTTIME access_time;
NTTIME write_time;
NTTIME change_time;
- large_t alloc_size;
- large_t size;
+ uint64_t alloc_size;
+ uint64_t size;
uint32 attrib;
} out;
} network_open_information;
@@ -820,7 +810,7 @@ union smb_setfileinfo {
struct {
/* w2k3 rounds this up to nearest 4096 */
- large_t alloc_size;
+ uint64_t alloc_size;
} in;
} allocation_info;
@@ -831,7 +821,7 @@ union smb_setfileinfo {
union setfileinfo_file file;
struct {
- large_t size;
+ uint64_t size;
} in;
} end_of_file_info;
@@ -853,7 +843,7 @@ union smb_setfileinfo {
union setfileinfo_file file;
struct {
- large_t position;
+ uint64_t position;
} in;
} position_information;
@@ -876,19 +866,19 @@ union smb_setfileinfo {
union setfileinfo_file file;
struct {
uint32 mode; /* yuck - this field remains to fix compile of libcli/clifile.c */
- large_t end_of_file;
- large_t num_bytes;
+ uint64_t end_of_file;
+ uint64_t num_bytes;
NTTIME status_change_time;
NTTIME access_time;
NTTIME change_time;
- large_t uid;
- large_t gid;
+ uint64_t uid;
+ uint64_t gid;
uint32 file_type;
- large_t dev_major;
- large_t dev_minor;
- large_t unique_id;
- large_t permissions;
- large_t nlink;
+ uint64_t dev_major;
+ uint64_t dev_minor;
+ uint64_t unique_id;
+ uint64_t permissions;
+ uint64_t nlink;
} in;
} unix_basic;
@@ -930,8 +920,8 @@ union smb_fsinfo {
struct {
uint32 block_size;
- large_t blocks_total;
- large_t blocks_free;
+ uint64_t blocks_total;
+ uint64_t blocks_free;
uint32 fs_id;
NTTIME create_time;
uint32 serial_number;
@@ -939,9 +929,9 @@ union smb_fsinfo {
uint32 max_file_component_length;
uint32 device_type;
uint32 device_characteristics;
- large_t quota_soft;
- large_t quota_hard;
- large_t quota_flags;
+ uint64_t quota_soft;
+ uint64_t quota_hard;
+ uint64_t quota_flags;
struct GUID guid;
char *volume_name;
char *fs_type;
@@ -999,8 +989,8 @@ union smb_fsinfo {
enum fsinfo_level level;
struct {
- large_t total_alloc_units;
- large_t avail_alloc_units; /* maps to call_avail_alloc_units */
+ uint64_t total_alloc_units;
+ uint64_t avail_alloc_units; /* maps to call_avail_alloc_units */
uint32 sectors_per_unit;
uint32 bytes_per_sector;
} out;
@@ -1036,7 +1026,7 @@ union smb_fsinfo {
struct {
uint16 major_version;
uint16 minor_version;
- large_t capability;
+ uint64_t capability;
} out;
} unix_info;
@@ -1045,10 +1035,10 @@ union smb_fsinfo {
enum fsinfo_level level;
struct {
- large_t unknown[3];
- large_t quota_soft;
- large_t quota_hard;
- large_t quota_flags;
+ uint64_t unknown[3];
+ uint64_t quota_soft;
+ uint64_t quota_hard;
+ uint64_t quota_flags;
} out;
} quota_information;
@@ -1057,9 +1047,9 @@ union smb_fsinfo {
enum fsinfo_level level;
struct {
- large_t total_alloc_units;
- large_t call_avail_alloc_units;
- large_t actual_avail_alloc_units;
+ uint64_t total_alloc_units;
+ uint64_t call_avail_alloc_units;
+ uint64_t actual_avail_alloc_units;
uint32 sectors_per_unit;
uint32 bytes_per_sector;
} out;
@@ -1071,7 +1061,7 @@ union smb_fsinfo {
struct {
struct GUID guid;
- large_t unknown[6];
+ uint64_t unknown[6];
} out;
} objectid_information;
};
@@ -1096,7 +1086,7 @@ union smb_open {
uint32 flags;
uint32 root_fid;
uint32 access_mask;
- large_t alloc_size;
+ uint64_t alloc_size;
uint32 file_attr;
uint32 share_access;
uint32 open_disposition;
@@ -1115,8 +1105,8 @@ union smb_open {
NTTIME write_time;
NTTIME change_time;
uint32 attrib;
- large_t alloc_size;
- large_t size;
+ uint64_t alloc_size;
+ uint64_t size;
uint16 file_type;
uint16 ipc_state;
uint8 is_directory;
@@ -1264,7 +1254,7 @@ union smb_read {
struct {
uint16 fnum;
- SMB_BIG_UINT offset;
+ uint64_t offset;
uint32 size;
} in;
struct {
@@ -1280,7 +1270,7 @@ union smb_read {
struct {
uint16 fnum;
- SMB_BIG_UINT offset;
+ uint64_t offset;
uint16 maxcnt;
uint16 mincnt;
uint32 timeout;
@@ -1330,7 +1320,7 @@ union smb_read {
struct {
uint16 fnum;
- SMB_BIG_UINT offset;
+ uint64_t offset;
uint16 mincnt;
uint16 maxcnt;
uint16 remaining;
@@ -1357,7 +1347,7 @@ union smb_write {
struct {
uint16 fnum;
- SMB_BIG_UINT offset;
+ uint64_t offset;
uint32 count;
const char *data;
} in;
@@ -1405,7 +1395,7 @@ union smb_write {
struct {
uint16 fnum;
- SMB_BIG_UINT offset;
+ uint64_t offset;
uint16 wmode;
uint16 remaining;
uint32 count;
@@ -1491,8 +1481,8 @@ union smb_lock {
uint16 lock_cnt;
struct smb_lock_entry {
uint16 pid;
- SMB_BIG_UINT offset;
- SMB_BIG_UINT count;
+ uint64_t offset;
+ uint64_t count;
} *locks; /* unlocks are first in the arrray */
} in;
} lockx;
@@ -1831,8 +1821,8 @@ union smb_search_data {
NTTIME access_time;
NTTIME write_time;
NTTIME change_time;
- large_t size;
- large_t alloc_size;
+ uint64_t size;
+ uint64_t alloc_size;
uint32 attrib;
WIRE_STRING name;
} directory_info;
@@ -1844,8 +1834,8 @@ union smb_search_data {
NTTIME access_time;
NTTIME write_time;
NTTIME change_time;
- large_t size;
- large_t alloc_size;
+ uint64_t size;
+ uint64_t alloc_size;
uint32 attrib;
uint32 ea_size;
WIRE_STRING name;
@@ -1864,8 +1854,8 @@ union smb_search_data {
NTTIME access_time;
NTTIME write_time;
NTTIME change_time;
- large_t size;
- large_t alloc_size;
+ uint64_t size;
+ uint64_t alloc_size;
uint32 attrib;
uint32 ea_size;
WIRE_STRING short_name;
@@ -1879,11 +1869,11 @@ union smb_search_data {
NTTIME access_time;
NTTIME write_time;
NTTIME change_time;
- large_t size;
- large_t alloc_size;
+ uint64_t size;
+ uint64_t alloc_size;
uint32 attrib;
uint32 ea_size;
- large_t file_id;
+ uint64_t file_id;
WIRE_STRING name;
} id_full_directory_info;
@@ -1894,11 +1884,11 @@ union smb_search_data {
NTTIME access_time;
NTTIME write_time;
NTTIME change_time;
- large_t size;
- large_t alloc_size;
+ uint64_t size;
+ uint64_t alloc_size;
uint32 attrib;
uint32 ea_size;
- large_t file_id;
+ uint64_t file_id;
WIRE_STRING short_name;
WIRE_STRING name;
} id_both_directory_info;
@@ -1906,19 +1896,19 @@ union smb_search_data {
/* RAW_SEARCH_UNIX_INFO interface */
struct {
uint32 file_index;
- large_t size;
- large_t alloc_size;
+ uint64_t size;
+ uint64_t alloc_size;
NTTIME status_change_time;
NTTIME access_time;
NTTIME change_time;
- large_t uid;
- large_t gid;
+ uint64_t uid;
+ uint64_t gid;
uint32 file_type;
- large_t dev_major;
- large_t dev_minor;
- large_t unique_id;
- large_t permissions;
- large_t nlink;
+ uint64_t dev_major;
+ uint64_t dev_minor;
+ uint64_t unique_id;
+ uint64_t permissions;
+ uint64_t nlink;
const char *name;
} unix_info;
};
diff --git a/source4/lib/fsusage.c b/source4/lib/fsusage.c
index bb7cff0645..bff6fdda03 100644
--- a/source4/lib/fsusage.c
+++ b/source4/lib/fsusage.c
@@ -24,7 +24,7 @@
/* Return the number of TOSIZE-byte blocks used by
BLOCKS FROMSIZE-byte blocks, rounding away from zero.
*/
-static SMB_BIG_UINT adjust_blocks(SMB_BIG_UINT blocks, SMB_BIG_UINT fromsize, SMB_BIG_UINT tosize)
+static uint64_t adjust_blocks(uint64_t blocks, uint64_t fromsize, uint64_t tosize)
{
if (fromsize == tosize) /* e.g., from 512 to 512 */
return blocks;
@@ -40,10 +40,10 @@ static SMB_BIG_UINT adjust_blocks(SMB_BIG_UINT blocks, SMB_BIG_UINT fromsize, SM
results are returned in *dfree and *dsize, in 512 byte units
*/
-int sys_fsusage(const char *path, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize)
+int sys_fsusage(const char *path, uint64_t *dfree, uint64_t *dsize)
{
#ifdef STAT_STATFS3_OSF1
-#define CONVERT_BLOCKS(B) adjust_blocks ((SMB_BIG_UINT)(B), (SMB_BIG_UINT)fsd.f_fsize, (SMB_BIG_UINT)512)
+#define CONVERT_BLOCKS(B) adjust_blocks ((uint64_t)(B), (uint64_t)fsd.f_fsize, (uint64_t)512)
struct statfs fsd;
if (statfs (path, &fsd, sizeof (struct statfs)) != 0)
@@ -51,7 +51,7 @@ int sys_fsusage(const char *path, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize)
#endif /* STAT_STATFS3_OSF1 */
#ifdef STAT_STATFS2_FS_DATA /* Ultrix */
-#define CONVERT_BLOCKS(B) adjust_blocks ((SMB_BIG_UINT)(B), (SMB_BIG_UINT)1024, (SMB_BIG_UINT)512)
+#define CONVERT_BLOCKS(B) adjust_blocks ((uint64_t)(B), (uint64_t)1024, (uint64_t)512)
struct fs_data fsd;
if (statfs (path, &fsd) != 1)
@@ -62,7 +62,7 @@ int sys_fsusage(const char *path, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize)
#endif /* STAT_STATFS2_FS_DATA */
#ifdef STAT_STATFS2_BSIZE /* 4.3BSD, SunOS 4, HP-UX, AIX */
-#define CONVERT_BLOCKS(B) adjust_blocks ((SMB_BIG_UINT)(B), (SMB_BIG_UINT)fsd.f_bsize, (SMB_BIG_UINT)512)
+#define CONVERT_BLOCKS(B) adjust_blocks ((uint64_t)(B), (uint64_t)fsd.f_bsize, (uint64_t)512)
struct statfs fsd;
if (statfs (path, &fsd) < 0)
@@ -84,7 +84,7 @@ int sys_fsusage(const char *path, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize)
#ifdef STAT_STATFS2_FSIZE /* 4.4BSD */
-#define CONVERT_BLOCKS(B) adjust_blocks ((SMB_BIG_UINT)(B), (SMB_BIG_UINT)fsd.f_fsize, (SMB_BIG_UINT)512)
+#define CONVERT_BLOCKS(B) adjust_blocks ((uint64_t)(B), (uint64_t)fsd.f_fsize, (uint64_t)512)
struct statfs fsd;
@@ -94,12 +94,12 @@ int sys_fsusage(const char *path, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize)
#ifdef STAT_STATFS4 /* SVR3, Dynix, Irix, AIX */
# if _AIX || defined(_CRAY)
-# define CONVERT_BLOCKS(B) adjust_blocks ((SMB_BIG_UINT)(B), (SMB_BIG_UINT)fsd.f_bsize, (SMB_BIG_UINT)512)
+# define CONVERT_BLOCKS(B) adjust_blocks ((uint64_t)(B), (uint64_t)fsd.f_bsize, (uint64_t)512)
# ifdef _CRAY
# define f_bavail f_bfree
# endif
# else
-# define CONVERT_BLOCKS(B) ((SMB_BIG_UINT)B)
+# define CONVERT_BLOCKS(B) ((uint64_t)B)
# ifndef _SEQUENT_ /* _SEQUENT_ is DYNIX/ptx */
# ifndef DOLPHIN /* DOLPHIN 3.8.alfa/7.18 has f_bavail */
# define f_bavail f_bfree
@@ -119,7 +119,7 @@ int sys_fsusage(const char *path, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize)
#if defined(STAT_STATVFS) || defined(STAT_STATVFS64) /* SVR4 */
# define CONVERT_BLOCKS(B) \
- adjust_blocks ((SMB_BIG_UINT)(B), fsd.f_frsize ? (SMB_BIG_UINT)fsd.f_frsize : (SMB_BIG_UINT)fsd.f_bsize, (SMB_BIG_UINT)512)
+ adjust_blocks ((uint64_t)(B), fsd.f_frsize ? (uint64_t)fsd.f_frsize : (uint64_t)fsd.f_bsize, (uint64_t)512)
#ifdef STAT_STATVFS64
struct statvfs64 fsd;
diff --git a/source4/lib/ldb/common/ldb_msg.c b/source4/lib/ldb/common/ldb_msg.c
index 59d480a33a..055569b0ee 100644
--- a/source4/lib/ldb/common/ldb_msg.c
+++ b/source4/lib/ldb/common/ldb_msg.c
@@ -235,6 +235,28 @@ unsigned int ldb_msg_find_uint(const struct ldb_message *msg,
return strtoul(v->data, NULL, 0);
}
+int64_t ldb_msg_find_int64(const struct ldb_message *msg,
+ const char *attr_name,
+ int64_t default_value)
+{
+ const struct ldb_val *v = ldb_msg_find_ldb_val(msg, attr_name);
+ if (!v || !v->data) {
+ return default_value;
+ }
+ return strtoll(v->data, NULL, 0);
+}
+
+uint64_t ldb_msg_find_uint64(const struct ldb_message *msg,
+ const char *attr_name,
+ uint64_t default_value)
+{
+ const struct ldb_val *v = ldb_msg_find_ldb_val(msg, attr_name);
+ if (!v || !v->data) {
+ return default_value;
+ }
+ return strtoull(v->data, NULL, 0);
+}
+
double ldb_msg_find_double(const struct ldb_message *msg,
const char *attr_name,
double default_value)
diff --git a/source4/lib/registry/reg_backend_nt4/reg_backend_nt4.c b/source4/lib/registry/reg_backend_nt4/reg_backend_nt4.c
index e4f9447488..415f764f61 100644
--- a/source4/lib/registry/reg_backend_nt4/reg_backend_nt4.c
+++ b/source4/lib/registry/reg_backend_nt4/reg_backend_nt4.c
@@ -608,8 +608,7 @@ static KEY_SEC_DESC *nt_create_init_sec(REG_HANDLE *h)
#define REG_HANDLE_REGTYPE_NT 1
#define REG_HANDLE_REGTYPE_W9X 2
-#define TTTONTTIME(r, t1, t2) (r)->last_mod_time.low = (t1); \
- (r)->last_mod_time.high = (t2);
+#define TTTONTTIME(r, t1, t2) (r)->last_mod_time = (t1) | (((uint64_t)(t2)) << 32)
#define REGF_HDR_BLKSIZ 0x1000
diff --git a/source4/lib/system.c b/source4/lib/system.c
index 98d975aa50..8c9627eb26 100644
--- a/source4/lib/system.c
+++ b/source4/lib/system.c
@@ -248,36 +248,6 @@ SMB_OFF_T sys_lseek(int fd, SMB_OFF_T offset, int whence)
}
/*******************************************************************
- An fseek() wrapper that will deal with 64 bit filesizes.
-********************************************************************/
-
-int sys_fseek(FILE *fp, SMB_OFF_T offset, int whence)
-{
-#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(LARGE_SMB_OFF_T) && defined(HAVE_FSEEK64)
- return fseek64(fp, offset, whence);
-#elif defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(LARGE_SMB_OFF_T) && defined(HAVE_FSEEKO64)
- return fseeko64(fp, offset, whence);
-#else
- return fseek(fp, offset, whence);
-#endif
-}
-
-/*******************************************************************
- An ftell() wrapper that will deal with 64 bit filesizes.
-********************************************************************/
-
-SMB_OFF_T sys_ftell(FILE *fp)
-{
-#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(LARGE_SMB_OFF_T) && defined(HAVE_FTELL64)
- return (SMB_OFF_T)ftell64(fp);
-#elif defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(LARGE_SMB_OFF_T) && defined(HAVE_FTELLO64)
- return (SMB_OFF_T)ftello64(fp);
-#else
- return (SMB_OFF_T)ftell(fp);
-#endif
-}
-
-/*******************************************************************
A creat() wrapper that will deal with 64 bit filesizes.
********************************************************************/
diff --git a/source4/lib/time.c b/source4/lib/time.c
index ba650668c5..e3811c884e 100644
--- a/source4/lib/time.c
+++ b/source4/lib/time.c
@@ -23,11 +23,10 @@
#include "includes.h"
#ifndef TIME_T_MIN
-#define TIME_T_MIN ((time_t)0 < (time_t) -1 ? (time_t) 0 \
- : ~ (time_t) 0 << (sizeof (time_t) * 8 - 1))
+#define TIME_T_MIN 0
#endif
#ifndef TIME_T_MAX
-#define TIME_T_MAX (~ (time_t) 0 - TIME_T_MIN)
+#define TIME_T_MAX (~(time_t)0)
#endif
/*******************************************************************
@@ -84,35 +83,23 @@ int get_time_zone(time_t t)
return tm_diff(&tm_utc,tm);
}
-#define TIME_FIXUP_CONSTANT (369.0*365.25*24*60*60-(3.0*24*60*60+6.0*60*60))
+#define TIME_FIXUP_CONSTANT 11644473600LL
/****************************************************************************
interpret an 8 byte "filetime" structure to a time_t
It's originally in "100ns units since jan 1st 1601"
****************************************************************************/
-time_t nt_time_to_unix(const NTTIME *nt)
+time_t nt_time_to_unix(NTTIME nt)
{
- double d;
- time_t ret;
+ nt += 1000*1000*10/2;
+ nt /= 1000*1000*10;
+ nt -= TIME_FIXUP_CONSTANT;
- if (nt->high == 0) {
+ if (TIME_T_MIN >= nt || nt >= TIME_T_MAX) {
return 0;
}
- 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;
-
- if (TIME_T_MIN >= d || d >= TIME_T_MAX) {
- return 0;
- }
-
- ret = (time_t)(d+0.5);
-
- return ret;
+ return (time_t)nt;
}
@@ -122,30 +109,22 @@ This takes GMT as input
****************************************************************************/
void unix_to_nt_time(NTTIME *nt, time_t t)
{
- double d;
+ uint64_t t2;
- if (t==0) {
- nt->low = 0;
- nt->high = 0;
- return;
- }
- if (t == TIME_T_MAX) {
- nt->low = 0xffffffff;
- nt->high = 0x7fffffff;
+ if (t == (time_t)-1) {
+ *nt = (NTTIME)-1LL;
return;
}
- if (t == -1) {
- nt->low = 0xffffffff;
- nt->high = 0xffffffff;
+ if (t == 0) {
+ *nt = 0;
return;
}
- d = (double)(t);
- d += TIME_FIXUP_CONSTANT;
- d *= 1.0e7;
+ t2 = t;
+ t2 += TIME_FIXUP_CONSTANT;
+ t2 *= 1000*1000*10;
- nt->high = (uint32)(d * (1.0/(4.0*(double)(1<<30))));
- nt->low = (uint32)(d - ((double)nt->high)*4.0*(double)(1<<30));
+ *nt = t2;
}
@@ -390,18 +369,10 @@ char *timestring(TALLOC_CTX *mem_ctx, time_t t)
return TimeBuf;
}
-/****************************************************************************
-check if NTTIME is 0
-****************************************************************************/
-BOOL nt_time_is_zero(NTTIME *nt)
-{
- return (nt->high==0);
-}
-
/*
return a talloced string representing a NTTIME for human consumption
*/
-const char *nt_time_string(TALLOC_CTX *mem_ctx, const NTTIME *nt)
+const char *nt_time_string(TALLOC_CTX *mem_ctx, NTTIME nt)
{
time_t t = nt_time_to_unix(nt);
return talloc_strdup(mem_ctx, timestring(mem_ctx, t));
@@ -411,10 +382,9 @@ const char *nt_time_string(TALLOC_CTX *mem_ctx, const NTTIME *nt)
/*
put a NTTIME into a packet
*/
-void push_nttime(void *base, uint16 offset, NTTIME *t)
+void push_nttime(void *base, uint16 offset, NTTIME t)
{
- SIVAL(base, offset, t->low);
- SIVAL(base, offset+4, t->high);
+ SBVAL(base, offset, t);
}
/*
@@ -422,30 +392,7 @@ void push_nttime(void *base, uint16 offset, NTTIME *t)
*/
NTTIME pull_nttime(void *base, uint16 offset)
{
- NTTIME ret;
- ret.low = IVAL(base, offset);
- ret.high = IVAL(base, offset+4);
- return ret;
-}
-
-/*
- convert a NTTIME to a double in 100-nano-seconds since 1601
-*/
-double nttime_to_double_nt(NTTIME t)
-{
- const double t32 = 4294967296.0;
- return t.high*t32 + t.low;
-}
-
-/*
- convert a double in 100-nano-seconds since 1601 to a NTTIME
-*/
-NTTIME nttime_from_double_nt(double t)
-{
- const double t32 = 4294967296.0;
- NTTIME ret;
- ret.high = t / t32;
- ret.low = t - (ret.high*t32);
+ NTTIME ret = BVAL(base, offset);
return ret;
}
@@ -454,5 +401,5 @@ NTTIME nttime_from_double_nt(double t)
*/
NTTIME nttime_from_string(const char *s)
{
- return nttime_from_double_nt(strtod(s, NULL));
+ return strtoull(s, NULL, 0);
}
diff --git a/source4/libcli/clilist.c b/source4/libcli/clilist.c
index ee0357579c..ca4b6acdc7 100644
--- a/source4/libcli/clilist.c
+++ b/source4/libcli/clilist.c
@@ -45,9 +45,9 @@ static BOOL interpret_long_filename(int level,
ZERO_STRUCTP(finfo);
finfo->size = info->both_directory_info.size;
- finfo->ctime = nt_time_to_unix(&info->both_directory_info.create_time);
- finfo->atime = nt_time_to_unix(&info->both_directory_info.access_time);
- finfo->mtime = nt_time_to_unix(&info->both_directory_info.write_time);
+ finfo->ctime = nt_time_to_unix(info->both_directory_info.create_time);
+ finfo->atime = nt_time_to_unix(info->both_directory_info.access_time);
+ finfo->mtime = nt_time_to_unix(info->both_directory_info.write_time);
finfo->mode = info->both_directory_info.attrib; /* 32 bit->16 bit attrib */
if (info->both_directory_info.short_name.s) {
strncpy(finfo->short_name, info->both_directory_info.short_name.s,
diff --git a/source4/libcli/clitrans2.c b/source4/libcli/clitrans2.c
index 777150a257..dc8c2cdfec 100644
--- a/source4/libcli/clitrans2.c
+++ b/source4/libcli/clitrans2.c
@@ -85,16 +85,16 @@ NTSTATUS cli_qpathinfo2(struct cli_tree *tree, const char *fname,
return status;
if (c_time) {
- *c_time = nt_time_to_unix(&parms.all_info.out.create_time);
+ *c_time = nt_time_to_unix(parms.all_info.out.create_time);
}
if (a_time) {
- *a_time = nt_time_to_unix(&parms.all_info.out.access_time);
+ *a_time = nt_time_to_unix(parms.all_info.out.access_time);
}
if (m_time) {
- *m_time = nt_time_to_unix(&parms.all_info.out.change_time);
+ *m_time = nt_time_to_unix(parms.all_info.out.change_time);
}
if (w_time) {
- *w_time = nt_time_to_unix(&parms.all_info.out.write_time);
+ *w_time = nt_time_to_unix(parms.all_info.out.write_time);
}
if (size) {
*size = parms.all_info.out.size;
@@ -163,16 +163,16 @@ NTSTATUS cli_qfileinfo(struct cli_tree *tree, int fnum,
}
if (c_time) {
- *c_time = nt_time_to_unix(&parms.all_info.out.create_time);
+ *c_time = nt_time_to_unix(parms.all_info.out.create_time);
}
if (a_time) {
- *a_time = nt_time_to_unix(&parms.all_info.out.access_time);
+ *a_time = nt_time_to_unix(parms.all_info.out.access_time);
}
if (m_time) {
- *m_time = nt_time_to_unix(&parms.all_info.out.change_time);
+ *m_time = nt_time_to_unix(parms.all_info.out.change_time);
}
if (w_time) {
- *w_time = nt_time_to_unix(&parms.all_info.out.write_time);
+ *w_time = nt_time_to_unix(parms.all_info.out.write_time);
}
if (mode) {
*mode = parms.all_info.out.attrib;
diff --git a/source4/libcli/raw/clispnego.c b/source4/libcli/raw/clispnego.c
index e6cadc466c..7ad6be1006 100644
--- a/source4/libcli/raw/clispnego.c
+++ b/source4/libcli/raw/clispnego.c
@@ -141,9 +141,9 @@ BOOL spnego_parse_negTokenInit(DATA_BLOB blob,
asn1_start_tag(&data,ASN1_CONTEXT(0));
asn1_start_tag(&data,ASN1_SEQUENCE(0));
for (i=0; asn1_tag_remaining(&data) > 0 && i < ASN1_MAX_OIDS; i++) {
- char *oid = NULL;
- asn1_read_OID(&data,&oid);
- OIDs[i] = oid;
+ char *aoid = NULL;
+ asn1_read_OID(&data,&aoid);
+ OIDs[i] = aoid;
}
OIDs[i] = NULL;
asn1_end_tag(&data);
@@ -230,9 +230,9 @@ BOOL parse_negTokenTarg(DATA_BLOB blob, char *OIDs[ASN1_MAX_OIDS], DATA_BLOB *se
asn1_start_tag(&data, ASN1_CONTEXT(0));
asn1_start_tag(&data, ASN1_SEQUENCE(0));
for (i=0; asn1_tag_remaining(&data) > 0 && i < ASN1_MAX_OIDS; i++) {
- char *oid = NULL;
- asn1_read_OID(&data,&oid);
- OIDs[i] = oid;
+ char *aoid = NULL;
+ asn1_read_OID(&data,&aoid);
+ OIDs[i] = aoid;
}
OIDs[i] = NULL;
asn1_end_tag(&data);
diff --git a/source4/libcli/raw/rawnegotiate.c b/source4/libcli/raw/rawnegotiate.c
index 587050bef8..5b94ef63d8 100644
--- a/source4/libcli/raw/rawnegotiate.c
+++ b/source4/libcli/raw/rawnegotiate.c
@@ -106,7 +106,7 @@ NTSTATUS smb_raw_negotiate(struct cli_transport *transport)
/* this time arrives in real GMT */
ntt = cli_pull_nttime(req->in.vwv, VWV(11)+1);
- transport->negotiate.server_time = nt_time_to_unix(&ntt);
+ transport->negotiate.server_time = nt_time_to_unix(ntt);
transport->negotiate.capabilities = IVAL(req->in.vwv,VWV(9)+1);
transport->negotiate.secblob = cli_req_pull_blob(req, transport->mem_ctx, req->in.data, req->in.data_size);
diff --git a/source4/libcli/raw/rawrequest.c b/source4/libcli/raw/rawrequest.c
index 35a2d363df..085b445fba 100644
--- a/source4/libcli/raw/rawrequest.c
+++ b/source4/libcli/raw/rawrequest.c
@@ -831,11 +831,9 @@ BOOL cli_raw_pull_data(struct cli_request *req, const char *src, int len, char *
/*
put a NTTIME into a packet
*/
-
-void cli_push_nttime(void *base, uint16 offset, NTTIME *t)
+void cli_push_nttime(void *base, uint16 offset, NTTIME t)
{
- SIVAL(base, offset, t->low);
- SIVAL(base, offset+4, t->high);
+ SBVAL(base, offset, t);
}
/*
@@ -843,9 +841,7 @@ void cli_push_nttime(void *base, uint16 offset, NTTIME *t)
*/
NTTIME cli_pull_nttime(void *base, uint16 offset)
{
- NTTIME ret;
- ret.low = IVAL(base, offset);
- ret.high = IVAL(base, offset+4);
+ NTTIME ret = BVAL(base, offset);
return ret;
}
diff --git a/source4/libcli/raw/rawsetfileinfo.c b/source4/libcli/raw/rawsetfileinfo.c
index 9da94f161c..d8fc78972d 100644
--- a/source4/libcli/raw/rawsetfileinfo.c
+++ b/source4/libcli/raw/rawsetfileinfo.c
@@ -61,10 +61,10 @@ static BOOL smb_raw_setinfo_backend(struct cli_tree *tree,
case RAW_SFILEINFO_BASIC_INFO:
case RAW_SFILEINFO_BASIC_INFORMATION:
NEED_BLOB(40);
- cli_push_nttime(blob->data, 0, &parms->basic_info.in.create_time);
- cli_push_nttime(blob->data, 8, &parms->basic_info.in.access_time);
- cli_push_nttime(blob->data, 16, &parms->basic_info.in.write_time);
- cli_push_nttime(blob->data, 24, &parms->basic_info.in.change_time);
+ cli_push_nttime(blob->data, 0, parms->basic_info.in.create_time);
+ cli_push_nttime(blob->data, 8, parms->basic_info.in.access_time);
+ cli_push_nttime(blob->data, 16, parms->basic_info.in.write_time);
+ cli_push_nttime(blob->data, 24, parms->basic_info.in.change_time);
SIVAL(blob->data, 32, parms->basic_info.in.attrib);
SIVAL(blob->data, 36, 0); /* padding */
return True;
@@ -73,9 +73,9 @@ static BOOL smb_raw_setinfo_backend(struct cli_tree *tree,
NEED_BLOB(92);
SBVAL(blob->data, 0, parms->unix_basic.in.end_of_file);
SBVAL(blob->data, 8, parms->unix_basic.in.num_bytes);
- cli_push_nttime(blob->data, 16, &parms->unix_basic.in.status_change_time);
- cli_push_nttime(blob->data, 24, &parms->unix_basic.in.access_time);
- cli_push_nttime(blob->data, 32, &parms->unix_basic.in.change_time);
+ cli_push_nttime(blob->data, 16, parms->unix_basic.in.status_change_time);
+ cli_push_nttime(blob->data, 24, parms->unix_basic.in.access_time);
+ cli_push_nttime(blob->data, 32, parms->unix_basic.in.change_time);
SBVAL(blob->data, 40, parms->unix_basic.in.uid);
SBVAL(blob->data, 48, parms->unix_basic.in.gid);
SIVAL(blob->data, 56, parms->unix_basic.in.file_type);
diff --git a/source4/libcli/util/asn1.c b/source4/libcli/util/asn1.c
index 09d4fbb6c9..07c692f700 100644
--- a/source4/libcli/util/asn1.c
+++ b/source4/libcli/util/asn1.c
@@ -315,17 +315,17 @@ int asn1_tag_remaining(ASN1_DATA *data)
BOOL asn1_read_OID(ASN1_DATA *data, char **OID)
{
uint8 b;
- pstring oid;
+ pstring aoid;
fstring el;
if (!asn1_start_tag(data, ASN1_OID)) return False;
asn1_read_uint8(data, &b);
- oid[0] = 0;
+ aoid[0] = 0;
snprintf(el, sizeof(el), "%u", b/40);
- pstrcat(oid, el);
+ pstrcat(aoid, el);
snprintf(el, sizeof(el), " %u", b%40);
- pstrcat(oid, el);
+ pstrcat(aoid, el);
while (asn1_tag_remaining(data) > 0) {
unsigned v = 0;
@@ -334,12 +334,12 @@ BOOL asn1_read_OID(ASN1_DATA *data, char **OID)
v = (v<<7) | (b&0x7f);
} while (!data->has_error && b & 0x80);
snprintf(el, sizeof(el), " %u", v);
- pstrcat(oid, el);
+ pstrcat(aoid, el);
}
asn1_end_tag(data);
- *OID = strdup(oid);
+ *OID = strdup(aoid);
return !data->has_error;
}
diff --git a/source4/libcli/util/smbencrypt.c b/source4/libcli/util/smbencrypt.c
index 5468bdbebe..013f00d5fa 100644
--- a/source4/libcli/util/smbencrypt.c
+++ b/source4/libcli/util/smbencrypt.c
@@ -314,7 +314,7 @@ static DATA_BLOB NTLMv2_generate_client_data(const DATA_BLOB *names_blob)
generate_random_buffer(client_chal, sizeof(client_chal), False);
- push_nttime(long_date, 0, &nttime);
+ push_nttime(long_date, 0, nttime);
/* See http://www.ubiqx.org/cifs/SMB.html#SMB.8.5 */
diff --git a/source4/librpc/idl/misc.idl b/source4/librpc/idl/misc.idl
index fca8fe876e..551803fa8e 100644
--- a/source4/librpc/idl/misc.idl
+++ b/source4/librpc/idl/misc.idl
@@ -65,12 +65,6 @@ interface misc
GUID uuid;
} policy_handle;
- /* a 4 byte aligned 64-bit integer */
- typedef [public] struct {
- uint32 low;
- uint32 high;
- } ULONG8;
-
/* this is also used in samr and netlogon */
typedef [public, flag(NDR_PAHEX)] struct {
uint16 units_per_week;
diff --git a/source4/librpc/idl/netlogon.idl b/source4/librpc/idl/netlogon.idl
index 693e7bf57c..f3c2b1ff26 100644
--- a/source4/librpc/idl/netlogon.idl
+++ b/source4/librpc/idl/netlogon.idl
@@ -77,8 +77,8 @@ interface netlogon
/* in netr_AcctLockStr size seems to be be 24, and rrenard thinks
that the structure of the bindata looks like this:
- ULONG8 lockout_duration;
- ULONG8 reset_count;
+ uint64 lockout_duration;
+ uint64 reset_count;
uint32 bad_attempt_lockout;
uint32 dummy;
@@ -371,9 +371,9 @@ interface netlogon
NTTIME forcedlogoff;
uint16 minpasswdlen;
uint16 passwdhistorylen;
- ULONG8 pwd_must_change_time;
- ULONG8 pwd_can_change_time;
- ULONG8 sequence_num;
+ uint64 pwd_must_change_time;
+ uint64 pwd_can_change_time;
+ uint64 sequence_num;
NTTIME domain_create_time;
uint32 SecurityInformation;
sec_desc_buf sdbuf;
@@ -597,7 +597,7 @@ interface netlogon
[case(NETR_DELTA_DELETE_SECRET)] netr_DELTA_DELETE_SECRET delete_secret;
[case(NETR_DELTA_DELETE_GROUP2)] netr_DELTA_DELETE_USER *delete_group;
[case(NETR_DELTA_DELETE_USER2)] netr_DELTA_DELETE_USER *delete_user;
- [case(NETR_DELTA_MODIFY_COUNT)] ULONG8 *modified_count;
+ [case(NETR_DELTA_MODIFY_COUNT)] uint64 *modified_count;
} netr_DELTA_UNION;
typedef union {
@@ -643,7 +643,7 @@ interface netlogon
[in] netr_Authenticator credential,
[in,out] netr_Authenticator return_authenticator,
[in] uint32 database_id,
- [in,out] ULONG8 sequence_num,
+ [in,out] uint64 sequence_num,
[in] uint32 preferredmaximumlength,
[out] netr_DELTA_ENUM_ARRAY *delta_enum_array
);
diff --git a/source4/librpc/idl/samr.idl b/source4/librpc/idl/samr.idl
index 2ff4e86cd1..3c9005a1f3 100644
--- a/source4/librpc/idl/samr.idl
+++ b/source4/librpc/idl/samr.idl
@@ -129,12 +129,13 @@
uint16 min_pwd_len;
uint16 password_history;
uint32 password_properties;
- ULONG8 max_password_age;
- ULONG8 min_password_age;
+ /* yes, these are signed. They are in negative 100ns */
+ int64 max_password_age;
+ int64 min_password_age;
} samr_DomInfo1;
typedef struct {
- ULONG8 force_logoff_time;
+ uint64 force_logoff_time;
samr_Name comment;
samr_Name domain; /* domain name */
samr_Name primary; /* PDC name if this is a BDC */
@@ -148,7 +149,7 @@
} samr_DomInfo2;
typedef struct {
- ULONG8 force_logoff_time;
+ uint64 force_logoff_time;
} samr_DomInfo3;
typedef struct {
@@ -180,7 +181,7 @@
} samr_DomInfo9;
typedef struct {
- ULONG8 force_logoff_time;
+ uint64 force_logoff_time;
samr_Name comment;
samr_Name domain;
samr_Name primary;
@@ -1162,10 +1163,14 @@
/************************/
/* Function 0x3f */
+ const int SAMR_REJECT_OTHER = 0;
+ const int SAMR_REJECT_TOO_SHORT = 1;
+ const int SAMR_REJECT_COMPLEXITY = 2;
+
typedef struct {
+ uint32 reason;
uint32 unknown1;
uint32 unknown2;
- uint32 unknown3;
} samr_ChangeReject;
NTSTATUS samr_ChangePasswordUser3(
diff --git a/source4/librpc/ndr/ndr_basic.c b/source4/librpc/ndr/ndr_basic.c
index 33176ec9c0..f4cdf44dc0 100644
--- a/source4/librpc/ndr/ndr_basic.c
+++ b/source4/librpc/ndr/ndr_basic.c
@@ -66,19 +66,36 @@ NTSTATUS ndr_pull_uint32(struct ndr_pull *ndr, uint32 *v)
}
/*
- parse a HYPER_T
+ parse a uint64
*/
-NTSTATUS ndr_pull_HYPER_T(struct ndr_pull *ndr, HYPER_T *v)
+NTSTATUS ndr_pull_uint64(struct ndr_pull *ndr, uint64_t *v)
{
- NDR_PULL_ALIGN(ndr, 8);
+ NDR_PULL_ALIGN(ndr, 4);
NDR_PULL_NEED_BYTES(ndr, 8);
- v->low = NDR_IVAL(ndr, ndr->offset);
- v->high = NDR_IVAL(ndr, ndr->offset+4);
+ *v = NDR_IVAL(ndr, ndr->offset);
+ *v |= (uint64_t)(NDR_IVAL(ndr, ndr->offset+4)) << 32;
ndr->offset += 8;
return NT_STATUS_OK;
}
/*
+ parse a int64
+*/
+NTSTATUS ndr_pull_int64(struct ndr_pull *ndr, int64_t *v)
+{
+ return ndr_pull_uint64(ndr, (uint64_t *)v);
+}
+
+/*
+ parse a HYPER_T
+*/
+NTSTATUS ndr_pull_HYPER_T(struct ndr_pull *ndr, HYPER_T *v)
+{
+ NDR_PULL_ALIGN(ndr, 8);
+ return ndr_pull_uint64(ndr, v);
+}
+
+/*
pull a NTSTATUS
*/
NTSTATUS ndr_pull_NTSTATUS(struct ndr_pull *ndr, NTSTATUS *status)
@@ -215,18 +232,35 @@ NTSTATUS ndr_push_uint32(struct ndr_push *ndr, uint32 v)
}
/*
- push a HYPER_T
+ push a uint64
*/
-NTSTATUS ndr_push_HYPER_T(struct ndr_push *ndr, HYPER_T v)
+NTSTATUS ndr_push_uint64(struct ndr_push *ndr, uint64 v)
{
- NDR_PUSH_ALIGN(ndr, 8);
+ NDR_PUSH_ALIGN(ndr, 4);
NDR_PUSH_NEED_BYTES(ndr, 8);
- NDR_SIVAL(ndr, ndr->offset, v.low);
- NDR_SIVAL(ndr, ndr->offset+4, v.high);
+ NDR_SIVAL(ndr, ndr->offset, (v & 0xFFFFFFFF));
+ NDR_SIVAL(ndr, ndr->offset+4, (v>>32));
ndr->offset += 8;
return NT_STATUS_OK;
}
+/*
+ push a int64
+*/
+NTSTATUS ndr_push_int64(struct ndr_push *ndr, int64 v)
+{
+ return ndr_push_uint64(ndr, (uint64_t)v);
+}
+
+/*
+ push a HYPER_T
+*/
+NTSTATUS ndr_push_HYPER_T(struct ndr_push *ndr, HYPER_T v)
+{
+ NDR_PUSH_ALIGN(ndr, 8);
+ return ndr_push_uint64(ndr, v);
+}
+
NTSTATUS ndr_push_align(struct ndr_push *ndr, size_t size)
{
NDR_PUSH_ALIGN(ndr, size);
@@ -606,8 +640,7 @@ NTSTATUS ndr_push_string(struct ndr_push *ndr, int ndr_flags, const char *s)
*/
NTSTATUS ndr_push_NTTIME(struct ndr_push *ndr, NTTIME t)
{
- NDR_CHECK(ndr_push_uint32(ndr, t.low));
- NDR_CHECK(ndr_push_uint32(ndr, t.high));
+ NDR_CHECK(ndr_push_uint64(ndr, t));
return NT_STATUS_OK;
}
@@ -616,8 +649,7 @@ NTSTATUS ndr_push_NTTIME(struct ndr_push *ndr, NTTIME t)
*/
NTSTATUS ndr_pull_NTTIME(struct ndr_pull *ndr, NTTIME *t)
{
- NDR_CHECK(ndr_pull_uint32(ndr, &t->low));
- NDR_CHECK(ndr_pull_uint32(ndr, &t->high));
+ NDR_CHECK(ndr_pull_uint64(ndr, t));
return NT_STATUS_OK;
}
@@ -661,9 +693,22 @@ void ndr_print_uint32(struct ndr_print *ndr, const char *name, uint32 v)
ndr->print(ndr, "%-25s: 0x%08x (%u)", name, v, v);
}
+void ndr_print_uint64(struct ndr_print *ndr, const char *name, uint64 v)
+{
+ ndr->print(ndr, "%-25s: 0x%08x%08x", name, (uint32)(v >> 32), (uint32)(v & 0xFFFFFFFF));
+}
+
+void ndr_print_int64(struct ndr_print *ndr, const char *name, int64 v)
+{
+ ndr->print(ndr, "%-25s: 0x%08x%08x (%lld)", name,
+ (uint32)(v >> 32),
+ (uint32)(v & 0xFFFFFFFF),
+ v);
+}
+
void ndr_print_HYPER_T(struct ndr_print *ndr, const char *name, HYPER_T v)
{
- ndr->print(ndr, "%-25s: 0x%08x%08x", name, v.high, v.low);
+ ndr->print(ndr, "%-25s: 0x%08x%08x", name, (uint32)(v >> 32), (uint32)(v & 0xFFFFFFFF));
}
void ndr_print_ptr(struct ndr_print *ndr, const char *name, const void *p)
@@ -686,7 +731,7 @@ void ndr_print_string(struct ndr_print *ndr, const char *name, const char *s)
void ndr_print_NTTIME(struct ndr_print *ndr, const char *name, NTTIME t)
{
- ndr->print(ndr, "%-25s: %s", name, nt_time_string(ndr->mem_ctx, &t));
+ ndr->print(ndr, "%-25s: %s", name, nt_time_string(ndr->mem_ctx, t));
}
void ndr_print_time_t(struct ndr_print *ndr, const char *name, time_t t)
diff --git a/source4/ntvfs/ntvfs_generic.c b/source4/ntvfs/ntvfs_generic.c
index ea62f8c9a6..116b716474 100644
--- a/source4/ntvfs/ntvfs_generic.c
+++ b/source4/ntvfs/ntvfs_generic.c
@@ -153,7 +153,7 @@ NTSTATUS ntvfs_map_open(struct request_context *req, union smb_open *io)
ZERO_STRUCT(io->openx.out);
io->openx.out.fnum = io2.generic.out.fnum;
io->openx.out.attrib = io2.generic.out.attrib;
- io->openx.out.write_time = nt_time_to_unix(&io2.generic.out.write_time);
+ io->openx.out.write_time = nt_time_to_unix(io2.generic.out.write_time);
io->openx.out.size = io2.generic.out.size;
return NT_STATUS_OK;
@@ -235,7 +235,7 @@ NTSTATUS ntvfs_map_open(struct request_context *req, union smb_open *io)
ZERO_STRUCT(io->openx.out);
io->open.out.fnum = io2.generic.out.fnum;
io->open.out.attrib = io2.generic.out.attrib;
- io->open.out.write_time = nt_time_to_unix(&io2.generic.out.write_time);
+ io->open.out.write_time = nt_time_to_unix(io2.generic.out.write_time);
io->open.out.size = io2.generic.out.size;
io->open.out.rmode = DOS_OPEN_RDWR;
@@ -378,15 +378,15 @@ NTSTATUS ntvfs_map_fileinfo(struct request_context *req, union smb_fileinfo *inf
case RAW_FILEINFO_GETATTR:
info->getattr.out.attrib = info2->generic.out.attrib & 0xff;
info->getattr.out.size = info2->generic.out.size;
- info->getattr.out.write_time = nt_time_to_unix(&info2->generic.out.write_time);
+ info->getattr.out.write_time = nt_time_to_unix(info2->generic.out.write_time);
return NT_STATUS_OK;
case RAW_FILEINFO_GETATTRE:
info->getattre.out.attrib = info2->generic.out.attrib;
info->getattre.out.size = info2->generic.out.size;
- info->getattre.out.write_time = nt_time_to_unix(&info2->generic.out.write_time);
- info->getattre.out.create_time = nt_time_to_unix(&info2->generic.out.create_time);
- info->getattre.out.access_time = nt_time_to_unix(&info2->generic.out.access_time);
+ info->getattre.out.write_time = nt_time_to_unix(info2->generic.out.write_time);
+ info->getattre.out.create_time = nt_time_to_unix(info2->generic.out.create_time);
+ info->getattre.out.access_time = nt_time_to_unix(info2->generic.out.access_time);
info->getattre.out.alloc_size = info2->generic.out.alloc_size;
return NT_STATUS_OK;
@@ -427,18 +427,18 @@ NTSTATUS ntvfs_map_fileinfo(struct request_context *req, union smb_fileinfo *inf
return NT_STATUS_OK;
case RAW_FILEINFO_STANDARD:
- info->standard.out.create_time = nt_time_to_unix(&info2->generic.out.create_time);
- info->standard.out.access_time = nt_time_to_unix(&info2->generic.out.access_time);
- info->standard.out.write_time = nt_time_to_unix(&info2->generic.out.write_time);
+ info->standard.out.create_time = nt_time_to_unix(info2->generic.out.create_time);
+ info->standard.out.access_time = nt_time_to_unix(info2->generic.out.access_time);
+ info->standard.out.write_time = nt_time_to_unix(info2->generic.out.write_time);
info->standard.out.size = info2->generic.out.size;
info->standard.out.alloc_size = info2->generic.out.alloc_size;
info->standard.out.attrib = info2->generic.out.attrib;
return NT_STATUS_OK;
case RAW_FILEINFO_EA_SIZE:
- info->ea_size.out.create_time = nt_time_to_unix(&info2->generic.out.create_time);
- info->ea_size.out.access_time = nt_time_to_unix(&info2->generic.out.access_time);
- info->ea_size.out.write_time = nt_time_to_unix(&info2->generic.out.write_time);
+ info->ea_size.out.create_time = nt_time_to_unix(info2->generic.out.create_time);
+ info->ea_size.out.access_time = nt_time_to_unix(info2->generic.out.access_time);
+ info->ea_size.out.write_time = nt_time_to_unix(info2->generic.out.write_time);
info->ea_size.out.size = info2->generic.out.size;
info->ea_size.out.alloc_size = info2->generic.out.alloc_size;
info->ea_size.out.attrib = info2->generic.out.attrib;
diff --git a/source4/ntvfs/simple/svfs_util.c b/source4/ntvfs/simple/svfs_util.c
index 598b85f1ad..11e70d72c2 100644
--- a/source4/ntvfs/simple/svfs_util.c
+++ b/source4/ntvfs/simple/svfs_util.c
@@ -180,9 +180,9 @@ uint16 svfs_unix_to_dos_attrib(mode_t mode)
/*
build a file_id from a stat struct
*/
-large_t svfs_file_id(struct stat *st)
+uint64_t svfs_file_id(struct stat *st)
{
- large_t ret = st->st_ino;
+ uint64_t ret = st->st_ino;
ret <<= 32;
ret |= st->st_dev;
return ret;
diff --git a/source4/rpc_server/echo/rpc_echo.c b/source4/rpc_server/echo/rpc_echo.c
index 25ac28a664..c4e1256841 100644
--- a/source4/rpc_server/echo/rpc_echo.c
+++ b/source4/rpc_server/echo/rpc_echo.c
@@ -84,13 +84,11 @@ static NTSTATUS echo_TestCall2(struct dcesrv_call_state *dce_call, TALLOC_CTX *m
r->out.info->info3.v = 30;
break;
case 4:
- r->out.info->info4.v.low = 40;
- r->out.info->info4.v.high = 0;
+ r->out.info->info4.v = 40;
break;
case 5:
r->out.info->info5.v1 = 50;
- r->out.info->info5.v2.low = 60;
- r->out.info->info5.v2.high = 0;
+ r->out.info->info5.v2 = 60;
break;
case 6:
r->out.info->info6.v1 = 70;
@@ -98,8 +96,7 @@ static NTSTATUS echo_TestCall2(struct dcesrv_call_state *dce_call, TALLOC_CTX *m
break;
case 7:
r->out.info->info7.v1 = 80;
- r->out.info->info7.info4.v.low = 90;
- r->out.info->info7.info4.v.high = 0;
+ r->out.info->info7.info4.v = 90;
break;
default:
return NT_STATUS_INVALID_LEVEL;
diff --git a/source4/rpc_server/netlogon/dcerpc_netlogon.c b/source4/rpc_server/netlogon/dcerpc_netlogon.c
index 1dab39ebc1..d4e60771ba 100644
--- a/source4/rpc_server/netlogon/dcerpc_netlogon.c
+++ b/source4/rpc_server/netlogon/dcerpc_netlogon.c
@@ -423,7 +423,8 @@ static NTSTATUS netr_ServerPasswordSet(struct dcesrv_call_state *dce_call, TALLO
msg_set_pw,
NULL, /* Don't have plaintext */
NULL, &newNtHash,
- False /* This is not considered a password change */);
+ False /* This is not considered a password change */,
+ NULL);
if (!NT_STATUS_IS_OK(nt_status)) {
samdb_close(sam_ctx);
diff --git a/source4/rpc_server/samr/dcesrv_samr.c b/source4/rpc_server/samr/dcesrv_samr.c
index 0db3a4ff6a..7592c479fa 100644
--- a/source4/rpc_server/samr/dcesrv_samr.c
+++ b/source4/rpc_server/samr/dcesrv_samr.c
@@ -1715,8 +1715,8 @@ static NTSTATUS samr_SetUserInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX
/* the set password levels are handled separately */
case 24:
- status = samr_set_password(a_state->sam_ctx,
- dce_call,
+ status = samr_set_password(dce_call,
+ a_state->sam_ctx,
a_state->account_dn,
a_state->domain_state->domain_dn,
mem_ctx, msg,
diff --git a/source4/rpc_server/samr/samdb.c b/source4/rpc_server/samr/samdb.c
index c7a2f770c0..1d5b90a22d 100644
--- a/source4/rpc_server/samr/samdb.c
+++ b/source4/rpc_server/samr/samdb.c
@@ -233,6 +233,32 @@ uint_t samdb_search_uint(void *ctx,
}
/*
+ search the sam for a single signed 64 bit integer attribute in exactly 1 record
+*/
+int64_t samdb_search_int64(void *ctx,
+ TALLOC_CTX *mem_ctx,
+ int64_t default_value,
+ const char *basedn,
+ const char *attr_name,
+ const char *format, ...)
+{
+ va_list ap;
+ int count;
+ struct ldb_message **res;
+ const char * const attrs[2] = { attr_name, NULL };
+
+ va_start(ap, format);
+ count = samdb_search_v(ctx, mem_ctx, basedn, &res, attrs, format, ap);
+ va_end(ap);
+
+ if (count != 1) {
+ return default_value;
+ }
+
+ return samdb_result_int64(res[0], attr_name, default_value);
+}
+
+/*
search the sam for multipe records each giving a single string attribute
return the number of matches, or -1 on error
*/
@@ -289,6 +315,14 @@ uint_t samdb_result_uint(struct ldb_message *msg, const char *attr, uint_t defau
}
/*
+ pull a (signed) int64 from a result set.
+*/
+int64_t samdb_result_int64(struct ldb_message *msg, const char *attr, int64_t default_value)
+{
+ return ldb_msg_find_int64(msg, attr, default_value);
+}
+
+/*
pull a string from a result set.
*/
const char *samdb_result_string(struct ldb_message *msg, const char *attr,
@@ -350,11 +384,11 @@ NTTIME samdb_result_nttime(struct ldb_message *msg, const char *attr, const char
}
/*
- pull a double (really a large integer) from a result set.
+ pull a uint64_t from a result set.
*/
-double samdb_result_double(struct ldb_message *msg, const char *attr, double default_value)
+uint64_t samdb_result_uint64(struct ldb_message *msg, const char *attr, uint64_t default_value)
{
- return ldb_msg_find_double(msg, attr, default_value);
+ return ldb_msg_find_uint64(msg, attr, default_value);
}
@@ -365,17 +399,20 @@ double samdb_result_double(struct ldb_message *msg, const char *attr, double def
NTTIME samdb_result_allow_pwd_change(void *ctx, TALLOC_CTX *mem_ctx,
const char *domain_dn, struct ldb_message *msg, const char *attr)
{
- double attr_time = samdb_result_double(msg, attr, 0);
- if (attr_time > 0) {
- const char *minPwdAge = samdb_search_string(ctx, mem_ctx, NULL, "minPwdAge",
- "dn=%s", domain_dn);
- if (minPwdAge) {
- /* yes, this is a -= not a += as minPwdAge is stored as the negative
- of the number of 100-nano-seconds */
- attr_time -= strtod(minPwdAge, NULL);
- }
+ uint64_t attr_time = samdb_result_uint64(msg, attr, 0);
+ int64_t minPwdAge;
+
+ if (attr_time == 0) {
+ return 0;
}
- return nttime_from_double_nt(attr_time);
+
+ minPwdAge = samdb_search_int64(ctx, mem_ctx, 0, "minPwdAge", "dn=%s", domain_dn);
+
+ /* yes, this is a -= not a += as minPwdAge is stored as the negative
+ of the number of 100-nano-seconds */
+ attr_time -= minPwdAge;
+
+ return attr_time;
}
/*
@@ -385,17 +422,21 @@ NTTIME samdb_result_allow_pwd_change(void *ctx, TALLOC_CTX *mem_ctx,
NTTIME samdb_result_force_pwd_change(void *ctx, TALLOC_CTX *mem_ctx,
const char *domain_dn, struct ldb_message *msg, const char *attr)
{
- double attr_time = samdb_result_double(msg, attr, 0);
- if (attr_time > 0) {
- const char *maxPwdAge = samdb_search_string(ctx, mem_ctx, NULL, "maxPwdAge",
- "dn=%s", domain_dn);
- if (!maxPwdAge || strcmp(maxPwdAge, "0") == 0) {
- attr_time = 0;
- } else {
- attr_time -= strtod(maxPwdAge, NULL);
- }
+ uint64_t attr_time = samdb_result_uint64(msg, attr, 0);
+ int64_t maxPwdAge;
+
+ if (attr_time == 0) {
+ return 0;
}
- return nttime_from_double_nt(attr_time);
+
+ maxPwdAge = samdb_search_int64(ctx, mem_ctx, 0, "maxPwdAge", "dn=%s", domain_dn);
+ if (maxPwdAge == 0) {
+ attr_time = 0;
+ } else {
+ attr_time -= maxPwdAge;
+ }
+
+ return attr_time;
}
/*
@@ -721,12 +762,22 @@ int samdb_msg_add_uint(void *ctx, TALLOC_CTX *mem_ctx, struct ldb_message *msg,
}
/*
- add a double element to a message (actually a large integer)
+ add a (signed) int64_t element to a message
+*/
+int samdb_msg_add_int64(void *ctx, TALLOC_CTX *mem_ctx, struct ldb_message *msg,
+ const char *attr_name, int64_t v)
+{
+ const char *s = talloc_asprintf(mem_ctx, "%lld", v);
+ return samdb_msg_add_string(ctx, mem_ctx, msg, attr_name, s);
+}
+
+/*
+ add a uint64_t element to a message
*/
-int samdb_msg_add_double(void *ctx, TALLOC_CTX *mem_ctx, struct ldb_message *msg,
- const char *attr_name, double v)
+int samdb_msg_add_uint64(void *ctx, TALLOC_CTX *mem_ctx, struct ldb_message *msg,
+ const char *attr_name, uint64_t v)
{
- const char *s = talloc_asprintf(mem_ctx, "%.0f", v);
+ const char *s = talloc_asprintf(mem_ctx, "%llu", v);
return samdb_msg_add_string(ctx, mem_ctx, msg, attr_name, s);
}
diff --git a/source4/rpc_server/samr/samr_password.c b/source4/rpc_server/samr/samr_password.c
index 5b99e04fab..812e0c69b9 100644
--- a/source4/rpc_server/samr/samr_password.c
+++ b/source4/rpc_server/samr/samr_password.c
@@ -109,7 +109,8 @@ NTSTATUS samr_ChangePasswordUser(struct dcesrv_call_state *dce_call, TALLOC_CTX
status = samdb_set_password(a_state->sam_ctx, mem_ctx,
a_state->account_dn, a_state->domain_state->domain_dn,
- &mod, NULL, &new_lmPwdHash, &new_ntPwdHash, True);
+ &mod, NULL, &new_lmPwdHash, &new_ntPwdHash,
+ True, NULL);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
@@ -210,7 +211,7 @@ NTSTATUS samr_OemChangePasswordUser2(struct dcesrv_call_state *dce_call, TALLOC_
user_dn, domain_dn,
&mod, new_pass,
NULL, NULL,
- True);
+ True, NULL);
if (!NT_STATUS_IS_OK(status)) {
samdb_close(sam_ctx);
return status;
@@ -241,10 +242,158 @@ NTSTATUS samr_ChangePasswordUser2(struct dcesrv_call_state *dce_call, TALLOC_CTX
/*
samr_ChangePasswordUser3
*/
-NTSTATUS samr_ChangePasswordUser3(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
+NTSTATUS samr_ChangePasswordUser3(struct dcesrv_call_state *dce_call,
+ TALLOC_CTX *mem_ctx,
struct samr_ChangePasswordUser3 *r)
-{
- DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
+{
+ NTSTATUS status;
+ char new_pass[512];
+ uint32 new_pass_len;
+ void *sam_ctx = NULL;
+ const char *user_dn, *domain_dn = NULL;
+ int ret;
+ struct ldb_message **res, mod;
+ const char * const attrs[] = { "objectSid", "ntPwdHash", NULL };
+ const char * const dom_attrs[] = { "minPwdLength", "pwdHistoryLength",
+ "pwdProperties", "minPwdAge", "maxPwdAge",
+ NULL };
+ const char *domain_sid;
+ struct samr_Hash *ntPwdHash;
+ struct samr_DomInfo1 *dominfo;
+ struct samr_ChangeReject *reject;
+ uint32 reason = 0;
+
+ ZERO_STRUCT(r->out);
+
+ if (r->in.nt_password == NULL ||
+ r->in.nt_verifier == NULL) {
+ status = NT_STATUS_INVALID_PARAMETER;
+ goto failed;
+ }
+
+ /* this call doesn't take a policy handle, so we need to open
+ the sam db from scratch */
+ sam_ctx = samdb_connect();
+ if (sam_ctx == NULL) {
+ status = NT_STATUS_INVALID_SYSTEM_SERVICE;
+ goto failed;
+ }
+
+ /* we need the users dn and the domain dn (derived from the
+ user SID). We also need the current lm and nt password hashes
+ in order to decrypt the incoming passwords */
+ ret = samdb_search(sam_ctx,
+ mem_ctx, NULL, &res, attrs,
+ "(&(sAMAccountName=%s)(objectclass=user))",
+ r->in.account->name);
+ if (ret != 1) {
+ status = NT_STATUS_NO_SUCH_USER;
+ goto failed;
+ }
+
+ user_dn = res[0]->dn;
+
+ ret = samdb_result_hashes(mem_ctx, res[0], "ntPwdHash", &ntPwdHash);
+ if (ret != 1) {
+ status = NT_STATUS_WRONG_PASSWORD;
+ goto failed;
+ }
+
+ /* decrypt the password we have been given */
+ SamOEMhash(r->in.nt_password->data, ntPwdHash->hash, 516);
+
+ if (!decode_pw_buffer(r->in.nt_password->data, new_pass, sizeof(new_pass),
+ &new_pass_len, STR_UNICODE)) {
+ DEBUG(3,("samr: failed to decode password buffer\n"));
+ status = NT_STATUS_WRONG_PASSWORD;
+ goto failed;
+ }
+
+ /* work out the domain dn */
+ domain_sid = samdb_result_sid_prefix(mem_ctx, res[0], "objectSid");
+ if (domain_sid == NULL) {
+ status = NT_STATUS_NO_SUCH_DOMAIN;
+ goto failed;
+ }
+
+ domain_dn = samdb_search_string(sam_ctx, mem_ctx, NULL, "dn",
+ "(objectSid=%s)", domain_sid);
+ if (!domain_dn) {
+ status = NT_STATUS_INTERNAL_DB_CORRUPTION;
+ goto failed;
+ }
+
+
+ ZERO_STRUCT(mod);
+ mod.dn = talloc_strdup(mem_ctx, user_dn);
+ if (!mod.dn) {
+ status = NT_STATUS_NO_MEMORY;
+ goto failed;
+ }
+
+ /* set the password - samdb needs to know both the domain and user DNs,
+ so the domain password policy can be used */
+ status = samdb_set_password(sam_ctx, mem_ctx,
+ user_dn, domain_dn,
+ &mod, new_pass,
+ NULL, NULL,
+ True, &reason);
+ if (!NT_STATUS_IS_OK(status)) {
+ goto failed;
+ }
+
+ /* modify the samdb record */
+ ret = samdb_replace(sam_ctx, mem_ctx, &mod);
+ if (ret != 0) {
+ status = NT_STATUS_UNSUCCESSFUL;
+ goto failed;
+ }
+
+ samdb_close(sam_ctx);
+ return NT_STATUS_OK;
+
+failed:
+ if (sam_ctx) {
+ samdb_close(sam_ctx);
+ }
+
+ /* on failure we need to fill in the reject reasons */
+ dominfo = talloc_p(mem_ctx, struct samr_DomInfo1);
+ if (dominfo == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+ reject = talloc_p(mem_ctx, struct samr_ChangeReject);
+ if (reject == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ ZERO_STRUCTP(dominfo);
+ ZERO_STRUCTP(reject);
+
+ reject->reason = reason;
+
+ r->out.dominfo = dominfo;
+ r->out.reject = reject;
+
+ if (!domain_dn) {
+ return status;
+ }
+
+ ret = samdb_search(sam_ctx,
+ mem_ctx, NULL, &res, dom_attrs,
+ "dn=%s", domain_dn);
+ if (ret != 1) {
+ status = NT_STATUS_NO_SUCH_USER;
+ goto failed;
+ }
+
+ dominfo->min_pwd_len = samdb_result_uint(res[0], "minPwdLength", 0);
+ dominfo->password_properties = samdb_result_uint(res[0], "pwdProperties", 0);
+ dominfo->password_history = samdb_result_uint(res[0], "pwdHistoryLength", 0);
+ dominfo->max_password_age = samdb_result_int64(res[0], "maxPwdAge", 0);
+ dominfo->min_password_age = samdb_result_int64(res[0], "minPwdAge", 0);
+
+ return status;
}
@@ -269,12 +418,13 @@ BOOL samdb_password_complexity_ok(const char *pass)
changes (as is needed by some of the set user info levels)
*/
NTSTATUS samdb_set_password(void *ctx, TALLOC_CTX *mem_ctx,
- const char *user_dn, const char *domain_dn,
- struct ldb_message *mod,
- const char *new_pass,
- struct samr_Hash *lmNewHash,
- struct samr_Hash *ntNewHash,
- BOOL user_change)
+ const char *user_dn, const char *domain_dn,
+ struct ldb_message *mod,
+ const char *new_pass,
+ struct samr_Hash *lmNewHash,
+ struct samr_Hash *ntNewHash,
+ BOOL user_change,
+ uint32 *reject_reason)
{
const char * const user_attrs[] = { "userAccountControl", "lmPwdHistory",
"ntPwdHistory", "unicodePwd",
@@ -284,7 +434,8 @@ NTSTATUS samdb_set_password(void *ctx, TALLOC_CTX *mem_ctx,
"maxPwdAge", "minPwdAge",
"minPwdLength", "pwdLastSet", NULL };
const char *unicodePwd;
- double minPwdAge, pwdLastSet;
+ NTTIME pwdLastSet;
+ int64_t minPwdAge;
uint_t minPwdLength, pwdProperties, pwdHistoryLength;
uint_t userAccountControl, badPwdCount;
struct samr_Hash *lmPwdHistory, *ntPwdHistory, lmPwdHash, ntPwdHash;
@@ -295,12 +446,10 @@ NTSTATUS samdb_set_password(void *ctx, TALLOC_CTX *mem_ctx,
int count;
time_t now = time(NULL);
NTTIME now_nt;
- double now_double;
int i;
/* we need to know the time to compute password age */
unix_to_nt_time(&now_nt, now);
- now_double = nttime_to_double_nt(now_nt);
/* pull all the user parameters */
count = samdb_search(ctx, mem_ctx, NULL, &res, user_attrs, "dn=%s", user_dn);
@@ -316,7 +465,7 @@ NTSTATUS samdb_set_password(void *ctx, TALLOC_CTX *mem_ctx,
"ntPwdHistory", &ntPwdHistory);
lmPwdHash = samdb_result_hash(res[0], "lmPwdHash");
ntPwdHash = samdb_result_hash(res[0], "ntPwdHash");
- pwdLastSet = samdb_result_double(res[0], "pwdLastSet", 0);
+ pwdLastSet = samdb_result_uint64(res[0], "pwdLastSet", 0);
/* pull the domain parameters */
count = samdb_search(ctx, mem_ctx, NULL, &res, domain_attrs, "dn=%s", domain_dn);
@@ -326,17 +475,23 @@ NTSTATUS samdb_set_password(void *ctx, TALLOC_CTX *mem_ctx,
pwdProperties = samdb_result_uint(res[0], "pwdProperties", 0);
pwdHistoryLength = samdb_result_uint(res[0], "pwdHistoryLength", 0);
minPwdLength = samdb_result_uint(res[0], "minPwdLength", 0);
- minPwdAge = samdb_result_double(res[0], "minPwdAge", 0);
+ minPwdAge = samdb_result_int64(res[0], "minPwdAge", 0);
if (new_pass) {
/* check the various password restrictions */
if (minPwdLength > str_charnum(new_pass)) {
+ if (reject_reason) {
+ *reject_reason = SAMR_REJECT_TOO_SHORT;
+ }
return NT_STATUS_PASSWORD_RESTRICTION;
}
/* possibly check password complexity */
if (pwdProperties & DOMAIN_PASSWORD_COMPLEX &&
!samdb_password_complexity_ok(new_pass)) {
+ if (reject_reason) {
+ *reject_reason = SAMR_REJECT_COMPLEXITY;
+ }
return NT_STATUS_PASSWORD_RESTRICTION;
}
@@ -351,25 +506,40 @@ NTSTATUS samdb_set_password(void *ctx, TALLOC_CTX *mem_ctx,
if (user_change) {
/* are all password changes disallowed? */
if (pwdProperties & DOMAIN_REFUSE_PASSWORD_CHANGE) {
+ if (reject_reason) {
+ *reject_reason = SAMR_REJECT_OTHER;
+ }
return NT_STATUS_PASSWORD_RESTRICTION;
}
/* can this user change password? */
if (userAccountControl & UF_PASSWD_CANT_CHANGE) {
+ if (reject_reason) {
+ *reject_reason = SAMR_REJECT_OTHER;
+ }
return NT_STATUS_PASSWORD_RESTRICTION;
}
/* yes, this is a minus. The ages are in negative 100nsec units! */
- if (pwdLastSet - minPwdAge > now_double) {
+ if (pwdLastSet - minPwdAge > now_nt) {
+ if (reject_reason) {
+ *reject_reason = SAMR_REJECT_OTHER;
+ }
return NT_STATUS_PASSWORD_RESTRICTION;
}
/* check the immediately past password */
if (pwdHistoryLength > 0) {
if (lmNewHash && memcmp(lmNewHash->hash, lmPwdHash.hash, 16) == 0) {
+ if (reject_reason) {
+ *reject_reason = SAMR_REJECT_COMPLEXITY;
+ }
return NT_STATUS_PASSWORD_RESTRICTION;
}
if (ntNewHash && memcmp(ntNewHash->hash, ntPwdHash.hash, 16) == 0) {
+ if (reject_reason) {
+ *reject_reason = SAMR_REJECT_COMPLEXITY;
+ }
return NT_STATUS_PASSWORD_RESTRICTION;
}
}
@@ -380,23 +550,38 @@ NTSTATUS samdb_set_password(void *ctx, TALLOC_CTX *mem_ctx,
if (pwdHistoryLength > 0) {
if (unicodePwd && new_pass && strcmp(unicodePwd, new_pass) == 0) {
+ if (reject_reason) {
+ *reject_reason = SAMR_REJECT_COMPLEXITY;
+ }
return NT_STATUS_PASSWORD_RESTRICTION;
}
if (lmNewHash && memcmp(lmNewHash->hash, lmPwdHash.hash, 16) == 0) {
+ if (reject_reason) {
+ *reject_reason = SAMR_REJECT_COMPLEXITY;
+ }
return NT_STATUS_PASSWORD_RESTRICTION;
}
if (ntNewHash && memcmp(ntNewHash->hash, ntPwdHash.hash, 16) == 0) {
+ if (reject_reason) {
+ *reject_reason = SAMR_REJECT_COMPLEXITY;
+ }
return NT_STATUS_PASSWORD_RESTRICTION;
}
}
for (i=0; lmNewHash && i<lmPwdHistory_len;i++) {
if (memcmp(lmNewHash->hash, lmPwdHistory[i].hash, 16) == 0) {
+ if (reject_reason) {
+ *reject_reason = SAMR_REJECT_COMPLEXITY;
+ }
return NT_STATUS_PASSWORD_RESTRICTION;
}
}
for (i=0; ntNewHash && i<ntPwdHistory_len;i++) {
if (memcmp(ntNewHash->hash, ntPwdHistory[i].hash, 16) == 0) {
+ if (reject_reason) {
+ *reject_reason = SAMR_REJECT_COMPLEXITY;
+ }
return NT_STATUS_PASSWORD_RESTRICTION;
}
}
@@ -425,7 +610,7 @@ NTSTATUS samdb_set_password(void *ctx, TALLOC_CTX *mem_ctx,
CHECK_RET(samdb_msg_add_delete(ctx, mem_ctx, mod, "unicodePwd"));
}
- CHECK_RET(samdb_msg_add_double(ctx, mem_ctx, mod, "pwdLastSet", now_double));
+ CHECK_RET(samdb_msg_add_uint64(ctx, mem_ctx, mod, "pwdLastSet", now_nt));
if (pwdHistoryLength == 0) {
CHECK_RET(samdb_msg_add_delete(ctx, mem_ctx, mod, "lmPwdHistory"));
@@ -509,6 +694,7 @@ NTSTATUS samr_set_password(struct dcesrv_call_state *dce_call,
account_dn, domain_dn,
msg, new_pass,
NULL, NULL,
- False /* This is a password set, not change */);
+ False /* This is a password set, not change */,
+ NULL);
}
diff --git a/source4/smb_server/negprot.c b/source4/smb_server/negprot.c
index 253dc1d7a4..43dc5094df 100644
--- a/source4/smb_server/negprot.c
+++ b/source4/smb_server/negprot.c
@@ -256,13 +256,11 @@ static void reply_nt1(struct request_context *req, uint16 choice)
capabilities |= CAP_UNIX;
}
- if (lp_large_readwrite() && (SMB_OFF_T_BITS == 64)) {
+ if (lp_large_readwrite()) {
capabilities |= CAP_LARGE_READX | CAP_LARGE_WRITEX | CAP_W2K_SMBS;
}
- if (SMB_OFF_T_BITS >= 64) {
- capabilities |= CAP_LARGE_FILES;
- }
+ capabilities |= CAP_LARGE_FILES;
if (lp_readraw() && lp_writeraw()) {
capabilities |= CAP_RAW_MODE;
@@ -320,7 +318,7 @@ static void reply_nt1(struct request_context *req, uint16 choice)
SIVAL(req->out.vwv+1, VWV(5), 0x10000); /* raw size. full 64k */
SIVAL(req->out.vwv+1, VWV(7), req->smb->pid); /* session key */
SIVAL(req->out.vwv+1, VWV(9), capabilities);
- push_nttime(req->out.vwv+1, VWV(11), &nttime);
+ push_nttime(req->out.vwv+1, VWV(11), nttime);
SSVALS(req->out.vwv+1,VWV(15), req->smb->negotiate.zone_offset/60);
if (!negotiate_spnego) {
diff --git a/source4/smb_server/reply.c b/source4/smb_server/reply.c
index 073ee956ca..eab71c519c 100644
--- a/source4/smb_server/reply.c
+++ b/source4/smb_server/reply.c
@@ -672,13 +672,7 @@ void reply_readbraw(struct request_context *req)
/* the 64 bit varient */
if (req->in.wct == 10) {
uint32 offset_high = IVAL(req->in.vwv, VWV(8));
-#ifdef LARGE_SMB_OFF_T
io.readbraw.in.offset |= (((SMB_OFF_T)offset_high) << 32);
-#else
- if (offset_high != 0) {
- goto failed;
- }
-#endif
}
/* before calling the backend we setup the raw buffer. This
@@ -884,14 +878,7 @@ void reply_read_and_X(struct request_context *req)
/* the 64 bit varient */
if (req->in.wct == 12) {
uint32 offset_high = IVAL(req->in.vwv, VWV(10));
-#ifdef LARGE_SMB_OFF_T
- io->readx.in.offset |= (((SMB_OFF_T)offset_high) << 32);
-#else
- if (offset_high != 0) {
- req_reply_error(req, NT_STATUS_FOOBAR);
- return;
- }
-#endif
+ io->readx.in.offset |= (((uint64_t)offset_high) << 32);
}
/* setup the reply packet assuming the maximum possible read */
@@ -1079,14 +1066,7 @@ void reply_write_and_X(struct request_context *req)
if (req->in.wct == 14) {
uint32 offset_high = IVAL(req->in.vwv, VWV(12));
uint16 count_high = SVAL(req->in.vwv, VWV(9));
-#ifdef LARGE_SMB_OFF_T
- io->writex.in.offset |= (((SMB_OFF_T)offset_high) << 32);
-#else
- if (offset_high != 0) {
- req_reply_error(req, NT_STATUS_FOOBAR);
- return;
- }
-#endif
+ io->writex.in.offset |= (((uint64_t)offset_high) << 32);
io->writex.in.count |= ((uint32)count_high) << 16;
}
@@ -1788,13 +1768,8 @@ void reply_lockingX(struct request_context *req)
lck->lockx.in.locks[i].count = IVAL(p, 6);
}
if (ofs_high != 0 || count_high != 0) {
-#ifdef LARGE_SMB_OFF_T
- lck->lockx.in.locks[i].count |= ((SMB_OFF_T)count_high) << 32;
- lck->lockx.in.locks[i].offset |= ((SMB_OFF_T)ofs_high) << 32;
-#else
- req_reply_error(req, NT_STATUS_FOOBAR);
- return;
-#endif
+ lck->lockx.in.locks[i].count |= ((uint64_t)count_high) << 32;
+ lck->lockx.in.locks[i].offset |= ((uint64_t)ofs_high) << 32;
}
p += lck_size;
}
@@ -2204,10 +2179,10 @@ static void reply_ntcreate_and_X_send(struct request_context *req)
/* the rest of the parameters are not aligned! */
SSVAL(req->out.vwv, 5, io->ntcreatex.out.fnum);
SIVAL(req->out.vwv, 7, io->ntcreatex.out.create_action);
- push_nttime(req->out.vwv, 11, &io->ntcreatex.out.create_time);
- push_nttime(req->out.vwv, 19, &io->ntcreatex.out.access_time);
- push_nttime(req->out.vwv, 27, &io->ntcreatex.out.write_time);
- push_nttime(req->out.vwv, 35, &io->ntcreatex.out.change_time);
+ push_nttime(req->out.vwv, 11, io->ntcreatex.out.create_time);
+ push_nttime(req->out.vwv, 19, io->ntcreatex.out.access_time);
+ push_nttime(req->out.vwv, 27, io->ntcreatex.out.write_time);
+ push_nttime(req->out.vwv, 35, io->ntcreatex.out.change_time);
SIVAL(req->out.vwv, 43, io->ntcreatex.out.attrib);
SBVAL(req->out.vwv, 47, io->ntcreatex.out.alloc_size);
SBVAL(req->out.vwv, 55, io->ntcreatex.out.size);
diff --git a/source4/smb_server/trans2.c b/source4/smb_server/trans2.c
index 3a8124bb3b..4ea8bdf55c 100644
--- a/source4/smb_server/trans2.c
+++ b/source4/smb_server/trans2.c
@@ -260,7 +260,7 @@ static NTSTATUS trans2_qfsinfo(struct request_context *req, struct smb_trans2 *t
trans2_setup_reply(req, trans, 0, 18, 0);
- push_nttime(trans->out.data.data, 0, &fsinfo.volume_info.out.create_time);
+ push_nttime(trans->out.data.data, 0, fsinfo.volume_info.out.create_time);
SIVAL(trans->out.data.data, 8, fsinfo.volume_info.out.serial_number);
trans2_append_data_string(req, trans,
&fsinfo.volume_info.out.volume_name,
@@ -408,10 +408,10 @@ static NTSTATUS trans2_fileinfo_fill(struct request_context *req, struct smb_tra
trans2_setup_reply(req, trans, 2, 40, 0);
SSVAL(trans->out.params.data, 0, 0);
- push_nttime(trans->out.data.data, 0, &st->basic_info.out.create_time);
- push_nttime(trans->out.data.data, 8, &st->basic_info.out.access_time);
- push_nttime(trans->out.data.data, 16, &st->basic_info.out.write_time);
- push_nttime(trans->out.data.data, 24, &st->basic_info.out.change_time);
+ push_nttime(trans->out.data.data, 0, st->basic_info.out.create_time);
+ push_nttime(trans->out.data.data, 8, st->basic_info.out.access_time);
+ push_nttime(trans->out.data.data, 16, st->basic_info.out.write_time);
+ push_nttime(trans->out.data.data, 24, st->basic_info.out.change_time);
SIVAL(trans->out.data.data, 32, st->basic_info.out.attrib);
SIVAL(trans->out.data.data, 36, 0); /* padding */
return NT_STATUS_OK;
@@ -445,10 +445,10 @@ static NTSTATUS trans2_fileinfo_fill(struct request_context *req, struct smb_tra
trans2_setup_reply(req, trans, 2, 56, 0);
SSVAL(trans->out.params.data, 0, 0);
- push_nttime(trans->out.data.data, 0, &st->network_open_information.out.create_time);
- push_nttime(trans->out.data.data, 8, &st->network_open_information.out.access_time);
- push_nttime(trans->out.data.data, 16, &st->network_open_information.out.write_time);
- push_nttime(trans->out.data.data, 24, &st->network_open_information.out.change_time);
+ push_nttime(trans->out.data.data, 0, st->network_open_information.out.create_time);
+ push_nttime(trans->out.data.data, 8, st->network_open_information.out.access_time);
+ push_nttime(trans->out.data.data, 16, st->network_open_information.out.write_time);
+ push_nttime(trans->out.data.data, 24, st->network_open_information.out.change_time);
SBVAL(trans->out.data.data, 32, st->network_open_information.out.alloc_size);
SBVAL(trans->out.data.data, 40, st->network_open_information.out.size);
SIVAL(trans->out.data.data, 48, st->network_open_information.out.attrib);
@@ -550,10 +550,10 @@ static NTSTATUS trans2_fileinfo_fill(struct request_context *req, struct smb_tra
trans2_setup_reply(req, trans, 2, 72, 0);
SSVAL(trans->out.params.data, 0, 0);
- push_nttime(trans->out.data.data, 0, &st->all_info.out.create_time);
- push_nttime(trans->out.data.data, 8, &st->all_info.out.access_time);
- push_nttime(trans->out.data.data, 16, &st->all_info.out.write_time);
- push_nttime(trans->out.data.data, 24, &st->all_info.out.change_time);
+ push_nttime(trans->out.data.data, 0, st->all_info.out.create_time);
+ push_nttime(trans->out.data.data, 8, st->all_info.out.access_time);
+ push_nttime(trans->out.data.data, 16, st->all_info.out.write_time);
+ push_nttime(trans->out.data.data, 24, st->all_info.out.change_time);
SIVAL(trans->out.data.data, 32, st->all_info.out.attrib);
SBVAL(trans->out.data.data, 40, st->all_info.out.alloc_size);
SBVAL(trans->out.data.data, 48, st->all_info.out.size);
@@ -930,10 +930,10 @@ static void find_fill_info(struct request_context *req,
trans2_grow_data(req, trans, ofs + 64);
data = trans->out.data.data + ofs;
SIVAL(data, 4, file->directory_info.file_index);
- push_nttime(data, 8, &file->directory_info.create_time);
- push_nttime(data, 16, &file->directory_info.access_time);
- push_nttime(data, 24, &file->directory_info.write_time);
- push_nttime(data, 32, &file->directory_info.change_time);
+ push_nttime(data, 8, file->directory_info.create_time);
+ push_nttime(data, 16, file->directory_info.access_time);
+ push_nttime(data, 24, file->directory_info.write_time);
+ push_nttime(data, 32, file->directory_info.change_time);
SBVAL(data, 40, file->directory_info.size);
SBVAL(data, 48, file->directory_info.alloc_size);
SIVAL(data, 56, file->directory_info.attrib);
@@ -947,10 +947,10 @@ static void find_fill_info(struct request_context *req,
trans2_grow_data(req, trans, ofs + 68);
data = trans->out.data.data + ofs;
SIVAL(data, 4, file->full_directory_info.file_index);
- push_nttime(data, 8, &file->full_directory_info.create_time);
- push_nttime(data, 16, &file->full_directory_info.access_time);
- push_nttime(data, 24, &file->full_directory_info.write_time);
- push_nttime(data, 32, &file->full_directory_info.change_time);
+ push_nttime(data, 8, file->full_directory_info.create_time);
+ push_nttime(data, 16, file->full_directory_info.access_time);
+ push_nttime(data, 24, file->full_directory_info.write_time);
+ push_nttime(data, 32, file->full_directory_info.change_time);
SBVAL(data, 40, file->full_directory_info.size);
SBVAL(data, 48, file->full_directory_info.alloc_size);
SIVAL(data, 56, file->full_directory_info.attrib);
@@ -975,10 +975,10 @@ static void find_fill_info(struct request_context *req,
trans2_grow_data(req, trans, ofs + 94);
data = trans->out.data.data + ofs;
SIVAL(data, 4, file->both_directory_info.file_index);
- push_nttime(data, 8, &file->both_directory_info.create_time);
- push_nttime(data, 16, &file->both_directory_info.access_time);
- push_nttime(data, 24, &file->both_directory_info.write_time);
- push_nttime(data, 32, &file->both_directory_info.change_time);
+ push_nttime(data, 8, file->both_directory_info.create_time);
+ push_nttime(data, 16, file->both_directory_info.access_time);
+ push_nttime(data, 24, file->both_directory_info.write_time);
+ push_nttime(data, 32, file->both_directory_info.change_time);
SBVAL(data, 40, file->both_directory_info.size);
SBVAL(data, 48, file->both_directory_info.alloc_size);
SIVAL(data, 56, file->both_directory_info.attrib);
@@ -999,10 +999,10 @@ static void find_fill_info(struct request_context *req,
trans2_grow_data(req, trans, ofs + 80);
data = trans->out.data.data + ofs;
SIVAL(data, 4, file->id_full_directory_info.file_index);
- push_nttime(data, 8, &file->id_full_directory_info.create_time);
- push_nttime(data, 16, &file->id_full_directory_info.access_time);
- push_nttime(data, 24, &file->id_full_directory_info.write_time);
- push_nttime(data, 32, &file->id_full_directory_info.change_time);
+ push_nttime(data, 8, file->id_full_directory_info.create_time);
+ push_nttime(data, 16, file->id_full_directory_info.access_time);
+ push_nttime(data, 24, file->id_full_directory_info.write_time);
+ push_nttime(data, 32, file->id_full_directory_info.change_time);
SBVAL(data, 40, file->id_full_directory_info.size);
SBVAL(data, 48, file->id_full_directory_info.alloc_size);
SIVAL(data, 56, file->id_full_directory_info.attrib);
@@ -1019,10 +1019,10 @@ static void find_fill_info(struct request_context *req,
trans2_grow_data(req, trans, ofs + 104);
data = trans->out.data.data + ofs;
SIVAL(data, 4, file->id_both_directory_info.file_index);
- push_nttime(data, 8, &file->id_both_directory_info.create_time);
- push_nttime(data, 16, &file->id_both_directory_info.access_time);
- push_nttime(data, 24, &file->id_both_directory_info.write_time);
- push_nttime(data, 32, &file->id_both_directory_info.change_time);
+ push_nttime(data, 8, file->id_both_directory_info.create_time);
+ push_nttime(data, 16, file->id_both_directory_info.access_time);
+ push_nttime(data, 24, file->id_both_directory_info.write_time);
+ push_nttime(data, 32, file->id_both_directory_info.change_time);
SBVAL(data, 40, file->id_both_directory_info.size);
SBVAL(data, 48, file->id_both_directory_info.alloc_size);
SIVAL(data, 56, file->id_both_directory_info.attrib);
diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c
index 32dd763b26..5c5bdf5955 100644
--- a/source4/torture/gentest.c
+++ b/source4/torture/gentest.c
@@ -1031,12 +1031,12 @@ again:
} while(0)
#define CHECK_NTTIMES_EQUAL(field) do { \
- if (ABS(nt_time_to_unix(&parm[0].field) - \
- nt_time_to_unix(&parm[1].field)) > time_skew() && \
+ if (ABS(nt_time_to_unix(parm[0].field) - \
+ nt_time_to_unix(parm[1].field)) > time_skew() && \
!ignore_pattern(#field)) { \
printf("Mismatch in %s - 0x%x 0x%x\n", #field, \
- (int)nt_time_to_unix(&parm[0].field), \
- (int)nt_time_to_unix(&parm[1].field)); \
+ (int)nt_time_to_unix(parm[0].field), \
+ (int)nt_time_to_unix(parm[1].field)); \
return False; \
} \
} while(0)
diff --git a/source4/torture/locktest.c b/source4/torture/locktest.c
index cfc3d95cde..99dcf9fd47 100644
--- a/source4/torture/locktest.c
+++ b/source4/torture/locktest.c
@@ -55,7 +55,7 @@ struct record {
enum lock_op lock_op;
enum brl_type lock_type;
char conn, f;
- SMB_BIG_UINT start, len;
+ uint64_t start, len;
char needed;
};
@@ -166,8 +166,8 @@ static BOOL test_one(struct cli_state *cli[NSERVERS][NCONNECTIONS],
{
unsigned conn = rec->conn;
unsigned f = rec->f;
- SMB_BIG_UINT start = rec->start;
- SMB_BIG_UINT len = rec->len;
+ uint64_t start = rec->start;
+ uint64_t len = rec->len;
enum brl_type op = rec->lock_type;
int server;
BOOL ret[NSERVERS];
diff --git a/source4/torture/raw/close.c b/source4/torture/raw/close.c
index 0180f43dd2..e2221946a0 100644
--- a/source4/torture/raw/close.c
+++ b/source4/torture/raw/close.c
@@ -77,10 +77,10 @@ BOOL torture_raw_close(int dummy)
status = smb_raw_pathinfo(cli->tree, mem_ctx, &finfo);
CHECK_STATUS(status, NT_STATUS_OK);
- if (basetime != nt_time_to_unix(&finfo.all_info.out.write_time)) {
+ if (basetime != nt_time_to_unix(finfo.all_info.out.write_time)) {
printf("Incorrect write time on file - %s - %s\n",
timestring(mem_ctx, basetime),
- nt_time_string(mem_ctx, &finfo.all_info.out.write_time));
+ nt_time_string(mem_ctx, finfo.all_info.out.write_time));
dump_all_info(mem_ctx, &finfo);
ret = False;
}
diff --git a/source4/torture/raw/open.c b/source4/torture/raw/open.c
index f559632f23..6b85b243d5 100644
--- a/source4/torture/raw/open.c
+++ b/source4/torture/raw/open.c
@@ -84,7 +84,7 @@ static const char *rdwr_string(enum rdwr_mode m)
status = smb_raw_pathinfo(cli->tree, mem_ctx, &finfo); \
CHECK_STATUS(status, NT_STATUS_OK); \
t1 = t & ~1; \
- t2 = nt_time_to_unix(&finfo.all_info.out.field) & ~1; \
+ t2 = nt_time_to_unix(finfo.all_info.out.field) & ~1; \
if (ABS(t1-t2) > 2) { \
printf("(%d) wrong time for field %s %s - %s\n", \
__LINE__, #field, \
@@ -101,11 +101,11 @@ static const char *rdwr_string(enum rdwr_mode m)
status = smb_raw_pathinfo(cli->tree, mem_ctx, &finfo); \
CHECK_STATUS(status, NT_STATUS_OK); \
t2 = finfo.all_info.out.field; \
- if (!nt_time_equal(&t, &t2)) { \
+ if (t != t2) { \
printf("(%d) wrong time for field %s %s - %s\n", \
__LINE__, #field, \
- nt_time_string(mem_ctx, &t), \
- nt_time_string(mem_ctx, &t2)); \
+ nt_time_string(mem_ctx, t), \
+ nt_time_string(mem_ctx, t2)); \
dump_all_info(mem_ctx, &finfo); \
ret = False; \
}} while (0)
diff --git a/source4/torture/raw/qfileinfo.c b/source4/torture/raw/qfileinfo.c
index 9c1c3a9e5c..14f30db97f 100644
--- a/source4/torture/raw/qfileinfo.c
+++ b/source4/torture/raw/qfileinfo.c
@@ -66,7 +66,7 @@ static struct {
/*
compare a dos time (2 second resolution) to a nt time
*/
-static int dos_nt_time_cmp(time_t t, const NTTIME *nt)
+static int dos_nt_time_cmp(time_t t, NTTIME nt)
{
time_t t2 = nt_time_to_unix(nt);
if (ABS(t2 - t) <= 2) return 0;
@@ -158,7 +158,7 @@ BOOL torture_raw_qfileinfo(int dummy)
int fnum;
const char *fname = "\\torture_qfileinfo.txt";
NTTIME correct_time;
- large_t correct_size;
+ uint64_t correct_size;
uint32 correct_attrib;
const char *correct_name;
BOOL skip_streams = False;
@@ -320,54 +320,54 @@ BOOL torture_raw_qfileinfo(int dummy)
s1 = fnum_find(sname); \
if (s1 && memcmp(&s1->stype.out.tfield, &correct_time, sizeof(correct_time)) != 0) { \
printf("(%d) handle %s/%s incorrect - %s should be %s\n", __LINE__, #stype, #tfield, \
- nt_time_string(mem_ctx, &s1->stype.out.tfield), \
- nt_time_string(mem_ctx, &correct_time)); \
+ nt_time_string(mem_ctx, s1->stype.out.tfield), \
+ nt_time_string(mem_ctx, correct_time)); \
ret = False; \
} \
s1 = fname_find(sname); \
if (s1 && memcmp(&s1->stype.out.tfield, &correct_time, sizeof(correct_time)) != 0) { \
printf("(%d) path %s/%s incorrect - %s should be %s\n", __LINE__, #stype, #tfield, \
- nt_time_string(mem_ctx, &s1->stype.out.tfield), \
- nt_time_string(mem_ctx, &correct_time)); \
+ nt_time_string(mem_ctx, s1->stype.out.tfield), \
+ nt_time_string(mem_ctx, correct_time)); \
ret = False; \
}} while (0)
#define TIME_CHECK_DOS(sname, stype, tfield) do { \
s1 = fnum_find(sname); \
- if (s1 && dos_nt_time_cmp(s1->stype.out.tfield, &correct_time) != 0) { \
+ if (s1 && dos_nt_time_cmp(s1->stype.out.tfield, correct_time) != 0) { \
printf("(%d) handle %s/%s incorrect - %s should be %s\n", __LINE__, #stype, #tfield, \
timestring(mem_ctx, s1->stype.out.tfield), \
- nt_time_string(mem_ctx, &correct_time)); \
+ nt_time_string(mem_ctx, correct_time)); \
ret = False; \
} \
s1 = fname_find(sname); \
- if (s1 && dos_nt_time_cmp(s1->stype.out.tfield, &correct_time) != 0) { \
+ if (s1 && dos_nt_time_cmp(s1->stype.out.tfield, correct_time) != 0) { \
printf("(%d) path %s/%s incorrect - %s should be %s\n", __LINE__, #stype, #tfield, \
timestring(mem_ctx, s1->stype.out.tfield), \
- nt_time_string(mem_ctx, &correct_time)); \
+ nt_time_string(mem_ctx, correct_time)); \
ret = False; \
}} while (0)
#define TIME_CHECK_UNX(sname, stype, tfield) do { \
s1 = fnum_find(sname); \
- if (s1 && unx_nt_time_cmp(s1->stype.out.tfield, &correct_time) != 0) { \
+ if (s1 && unx_nt_time_cmp(s1->stype.out.tfield, correct_time) != 0) { \
printf("(%d) handle %s/%s incorrect - %s should be %s\n", __LINE__, #stype, #tfield, \
timestring(mem_ctx, s1->stype.out.tfield), \
- nt_time_string(mem_ctx, &correct_time)); \
+ nt_time_string(mem_ctx, correct_time)); \
ret = False; \
} \
s1 = fname_find(sname); \
- if (s1 && unx_nt_time_cmp(s1->stype.out.tfield, &correct_time) != 0) { \
+ if (s1 && unx_nt_time_cmp(s1->stype.out.tfield, correct_time) != 0) { \
printf("(%d) path %s/%s incorrect - %s should be %s\n", __LINE__, #stype, #tfield, \
timestring(mem_ctx, s1->stype.out.tfield), \
- nt_time_string(mem_ctx, &correct_time)); \
+ nt_time_string(mem_ctx, correct_time)); \
ret = False; \
}} while (0)
/* now check that all the times that are supposed to be equal are correct */
s1 = fnum_find("BASIC_INFO");
correct_time = s1->basic_info.out.create_time;
- printf("create_time: %s\n", nt_time_string(mem_ctx, &correct_time));
+ printf("create_time: %s\n", nt_time_string(mem_ctx, correct_time));
TIME_CHECK_NT ("BASIC_INFO", basic_info, create_time);
TIME_CHECK_NT ("BASIC_INFORMATION", basic_info, create_time);
@@ -379,7 +379,7 @@ BOOL torture_raw_qfileinfo(int dummy)
s1 = fnum_find("BASIC_INFO");
correct_time = s1->basic_info.out.access_time;
- printf("access_time: %s\n", nt_time_string(mem_ctx, &correct_time));
+ printf("access_time: %s\n", nt_time_string(mem_ctx, correct_time));
TIME_CHECK_NT ("BASIC_INFO", basic_info, access_time);
TIME_CHECK_NT ("BASIC_INFORMATION", basic_info, access_time);
@@ -391,7 +391,7 @@ BOOL torture_raw_qfileinfo(int dummy)
s1 = fnum_find("BASIC_INFO");
correct_time = s1->basic_info.out.write_time;
- printf("write_time : %s\n", nt_time_string(mem_ctx, &correct_time));
+ printf("write_time : %s\n", nt_time_string(mem_ctx, correct_time));
TIME_CHECK_NT ("BASIC_INFO", basic_info, write_time);
TIME_CHECK_NT ("BASIC_INFORMATION", basic_info, write_time);
@@ -404,7 +404,7 @@ BOOL torture_raw_qfileinfo(int dummy)
s1 = fnum_find("BASIC_INFO");
correct_time = s1->basic_info.out.change_time;
- printf("change_time: %s\n", nt_time_string(mem_ctx, &correct_time));
+ printf("change_time: %s\n", nt_time_string(mem_ctx, correct_time));
TIME_CHECK_NT ("BASIC_INFO", basic_info, change_time);
TIME_CHECK_NT ("BASIC_INFORMATION", basic_info, change_time);
diff --git a/source4/torture/raw/read.c b/source4/torture/raw/read.c
index 3e9547856c..5e1d055e22 100644
--- a/source4/torture/raw/read.c
+++ b/source4/torture/raw/read.c
@@ -502,9 +502,8 @@ static BOOL test_readx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
status = smb_raw_read(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_FILE_LOCK_CONFLICT);
-#ifdef LARGE_SMB_OFF_T
printf("Trying large offset read\n");
- io.readx.in.offset = ((SMB_BIG_UINT)0x2) << 32;
+ io.readx.in.offset = ((uint64_t)0x2) << 32;
io.readx.in.mincnt = 10;
io.readx.in.maxcnt = 10;
status = smb_raw_read(cli->tree, &io);
@@ -520,7 +519,6 @@ static BOOL test_readx(struct cli_state *cli, TALLOC_CTX *mem_ctx)
status = smb_raw_read(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VALUE(io.readx.out.nread, 0);
-#endif
done:
cli_close(cli->tree, fnum);
@@ -684,16 +682,14 @@ static BOOL test_readbraw(struct cli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VALUE(io.readbraw.out.nread, 0);
-#ifdef LARGE_SMB_OFF_T
printf("Trying large offset read\n");
- io.readbraw.in.offset = ((SMB_BIG_UINT)0x2) << 32;
+ io.readbraw.in.offset = ((uint64_t)0x2) << 32;
io.readbraw.in.mincnt = 10;
io.readbraw.in.maxcnt = 10;
io.readbraw.in.timeout = 0;
status = smb_raw_read(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VALUE(io.readbraw.out.nread, 0);
-#endif
done:
cli_close(cli->tree, fnum);
diff --git a/source4/torture/raw/search.c b/source4/torture/raw/search.c
index 57c6eb2bb9..ae5d8c34a8 100644
--- a/source4/torture/raw/search.c
+++ b/source4/torture/raw/search.c
@@ -197,11 +197,11 @@ static BOOL test_one_file(struct cli_state *cli, TALLOC_CTX *mem_ctx)
#define CHECK_TIME(name, sname1, field1, v, sname2, field2) do { \
s = find(name); \
if (s) { \
- if (s->sname1.field1 != (~1 & nt_time_to_unix(&v.sname2.out.field2))) { \
+ if (s->sname1.field1 != (~1 & nt_time_to_unix(v.sname2.out.field2))) { \
printf("(%d) %s/%s [%s] != %s/%s [%s]\n", \
__LINE__, \
#sname1, #field1, timestring(mem_ctx, s->sname1.field1), \
- #sname2, #field2, nt_time_string(mem_ctx, &v.sname2.out.field2)); \
+ #sname2, #field2, nt_time_string(mem_ctx, v.sname2.out.field2)); \
ret = False; \
} \
}} while (0)
@@ -209,11 +209,11 @@ static BOOL test_one_file(struct cli_state *cli, TALLOC_CTX *mem_ctx)
#define CHECK_NTTIME(name, sname1, field1, v, sname2, field2) do { \
s = find(name); \
if (s) { \
- if (memcmp(&s->sname1.field1, &v.sname2.out.field2, sizeof(NTTIME))) { \
+ if (s->sname1.field1 != v.sname2.out.field2) { \
printf("(%d) %s/%s [%s] != %s/%s [%s]\n", \
__LINE__, \
- #sname1, #field1, nt_time_string(mem_ctx, &s->sname1.field1), \
- #sname2, #field2, nt_time_string(mem_ctx, &v.sname2.out.field2)); \
+ #sname1, #field1, nt_time_string(mem_ctx, s->sname1.field1), \
+ #sname2, #field2, nt_time_string(mem_ctx, v.sname2.out.field2)); \
ret = False; \
} \
}} while (0)
diff --git a/source4/torture/raw/setfileinfo.c b/source4/torture/raw/setfileinfo.c
index 3a49c8baff..fb2e0633e8 100644
--- a/source4/torture/raw/setfileinfo.c
+++ b/source4/torture/raw/setfileinfo.c
@@ -152,13 +152,13 @@ BOOL torture_raw_sfileinfo(int dummy)
#define CHECK_TIME(call, stype, field, value) do { \
CHECK1(call); \
- if (NT_STATUS_IS_OK(status) && NT_STATUS_IS_OK(status2) && nt_time_to_unix(&finfo2.stype.out.field) != value) { \
+ if (NT_STATUS_IS_OK(status) && NT_STATUS_IS_OK(status2) && nt_time_to_unix(finfo2.stype.out.field) != value) { \
printf("(%d) %s - %s/%s should be 0x%x - 0x%x\n", __LINE__, \
call_name, #stype, #field, \
(uint_t)value, \
- (uint_t)nt_time_to_unix(&finfo2.stype.out.field)); \
+ (uint_t)nt_time_to_unix(finfo2.stype.out.field)); \
printf("\t%s", timestring(mem_ctx, value)); \
- printf("\t%s\n", nt_time_string(mem_ctx, &finfo2.stype.out.field)); \
+ printf("\t%s\n", nt_time_string(mem_ctx, finfo2.stype.out.field)); \
dump_all_info(mem_ctx, &finfo1); \
}} while (0)
diff --git a/source4/torture/raw/write.c b/source4/torture/raw/write.c
index eb20fe3b84..18c992b8c6 100644
--- a/source4/torture/raw/write.c
+++ b/source4/torture/raw/write.c
@@ -187,7 +187,7 @@ static BOOL test_write(struct cli_state *cli, TALLOC_CTX *mem_ctx)
status = smb_raw_write(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VALUE(io.write.out.nwritten, 4000);
- CHECK_ALL_INFO(io.write.in.count + (SMB_BIG_UINT)io.write.in.offset, size);
+ CHECK_ALL_INFO(io.write.in.count + (uint64_t)io.write.in.offset, size);
memset(buf, 0, maxsize);
if (cli_read(cli->tree, fnum, buf, io.write.in.offset, 4000) != 4000) {
@@ -337,7 +337,7 @@ static BOOL test_writex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
status = smb_raw_write(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VALUE(io.writex.out.nwritten, 4000);
- CHECK_ALL_INFO(io.writex.in.count + (SMB_BIG_UINT)io.writex.in.offset, size);
+ CHECK_ALL_INFO(io.writex.in.count + (uint64_t)io.writex.in.offset, size);
memset(buf, 0, maxsize);
if (cli_read(cli->tree, fnum, buf, io.writex.in.offset, 4000) != 4000) {
@@ -352,12 +352,12 @@ static BOOL test_writex(struct cli_state *cli, TALLOC_CTX *mem_ctx)
setup_buffer(buf, seed+1, maxsize);
io.writex.in.fnum = fnum;
io.writex.in.count = 4000;
- io.writex.in.offset = ((SMB_BIG_UINT)1) << i;
+ io.writex.in.offset = ((uint64_t)1) << i;
io.writex.in.data = buf;
status = smb_raw_write(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VALUE(io.writex.out.nwritten, 4000);
- CHECK_ALL_INFO(io.writex.in.count + (SMB_BIG_UINT)io.writex.in.offset, size);
+ CHECK_ALL_INFO(io.writex.in.count + (uint64_t)io.writex.in.offset, size);
memset(buf, 0, maxsize);
if (cli_read(cli->tree, fnum, buf, io.writex.in.offset, 4000) != 4000) {
@@ -500,7 +500,7 @@ static BOOL test_writeunlock(struct cli_state *cli, TALLOC_CTX *mem_ctx)
status = smb_raw_write(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VALUE(io.writeunlock.out.nwritten, 4000);
- CHECK_ALL_INFO(io.writeunlock.in.count + (SMB_BIG_UINT)io.writeunlock.in.offset, size);
+ CHECK_ALL_INFO(io.writeunlock.in.count + (uint64_t)io.writeunlock.in.offset, size);
memset(buf, 0, maxsize);
if (cli_read(cli->tree, fnum, buf, io.writeunlock.in.offset, 4000) != 4000) {
@@ -650,7 +650,7 @@ static BOOL test_writeclose(struct cli_state *cli, TALLOC_CTX *mem_ctx)
status = smb_raw_write(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VALUE(io.writeclose.out.nwritten, 4000);
- CHECK_ALL_INFO(io.writeclose.in.count + (SMB_BIG_UINT)io.writeclose.in.offset, size);
+ CHECK_ALL_INFO(io.writeclose.in.count + (uint64_t)io.writeclose.in.offset, size);
fnum = cli_open(cli->tree, fname, O_RDWR, DENY_NONE);
io.writeclose.in.fnum = fnum;
diff --git a/source4/torture/rpc/netlogon.c b/source4/torture/rpc/netlogon.c
index 524af42e01..25c0496a00 100644
--- a/source4/torture/rpc/netlogon.c
+++ b/source4/torture/rpc/netlogon.c
@@ -1081,7 +1081,7 @@ static BOOL test_SetPassword(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
/* we remember the sequence numbers so we can easily do a DatabaseDelta */
-static struct ULONG8 sequence_nums[3];
+static uint64_t sequence_nums[3];
/*
try a netlogon DatabaseSync
@@ -1133,10 +1133,9 @@ static BOOL test_DatabaseSync(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
r.out.delta_enum_array->delta_enum[0].delta_union.domain) {
sequence_nums[r.in.database_id] =
r.out.delta_enum_array->delta_enum[0].delta_union.domain->sequence_num;
- printf("\tsequence_nums[%d]=0x%08x%08x\n",
+ printf("\tsequence_nums[%d]=%llu\n",
r.in.database_id,
- sequence_nums[r.in.database_id].high,
- sequence_nums[r.in.database_id].low);
+ sequence_nums[r.in.database_id]);
}
} while (NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES));
}
@@ -1170,13 +1169,13 @@ static BOOL test_DatabaseDeltas(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
r.in.database_id = database_ids[i];
r.in.sequence_num = sequence_nums[r.in.database_id];
- if (r.in.sequence_num.low == 0) continue;
+ if (r.in.sequence_num == 0) continue;
- r.in.sequence_num.low -= 1;
+ r.in.sequence_num -= 1;
- printf("Testing DatabaseDeltas of id %d at %d\n",
- r.in.database_id, r.in.sequence_num.low);
+ printf("Testing DatabaseDeltas of id %d at %llu\n",
+ r.in.database_id, r.in.sequence_num);
do {
creds_client_authenticator(&creds, &r.in.credential);
@@ -1193,8 +1192,7 @@ static BOOL test_DatabaseDeltas(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
printf("Credential chaining failed\n");
}
- r.in.sequence_num.low++;
- r.in.sequence_num.high = 0;
+ r.in.sequence_num++;
} while (NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES));
}
diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c
index 14c124af78..73d599209c 100644
--- a/source4/torture/rpc/samr.c
+++ b/source4/torture/rpc/samr.c
@@ -862,7 +862,7 @@ static BOOL test_ChangePasswordUser3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
struct samr_CryptPassword nt_pass, lm_pass;
struct samr_Hash nt_verifier, lm_verifier;
char *oldpass = *password;
- char *newpass = samr_rand_pass(mem_ctx);
+ char *newpass = samr_rand_pass(mem_ctx);
uint8 old_nt_hash[16], new_nt_hash[16];
uint8 old_lm_hash[16], new_lm_hash[16];
@@ -878,7 +878,7 @@ static BOOL test_ChangePasswordUser3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
E_deshash(newpass, new_lm_hash);
encode_pw_buffer(lm_pass.data, newpass, STR_UNICODE);
- SamOEMhash(lm_pass.data, old_lm_hash, 516);
+ SamOEMhash(lm_pass.data, old_nt_hash, 516);
E_old_pw_hash(new_lm_hash, old_lm_hash, lm_verifier.hash);
encode_pw_buffer(nt_pass.data, newpass, STR_UNICODE);
diff --git a/source4/torture/torture_util.c b/source4/torture/torture_util.c
index 96579999c3..5b9e36ea71 100644
--- a/source4/torture/torture_util.c
+++ b/source4/torture/torture_util.c
@@ -217,7 +217,7 @@ BOOL wire_bad_flags(WIRE_STRING *str, int flags)
*/
BOOL nt_time_equal(NTTIME *t1, NTTIME *t2)
{
- return t1->low == t2->low && t1->high == t2->high;
+ return *t1 == *t2;
}
/*
@@ -225,10 +225,10 @@ BOOL nt_time_equal(NTTIME *t1, NTTIME *t2)
*/
void dump_all_info(TALLOC_CTX *mem_ctx, union smb_fileinfo *finfo)
{
- d_printf("\tcreate_time: %s\n", nt_time_string(mem_ctx, &finfo->all_info.out.create_time));
- d_printf("\taccess_time: %s\n", nt_time_string(mem_ctx, &finfo->all_info.out.access_time));
- d_printf("\twrite_time: %s\n", nt_time_string(mem_ctx, &finfo->all_info.out.write_time));
- d_printf("\tchange_time: %s\n", nt_time_string(mem_ctx, &finfo->all_info.out.change_time));
+ d_printf("\tcreate_time: %s\n", nt_time_string(mem_ctx, finfo->all_info.out.create_time));
+ d_printf("\taccess_time: %s\n", nt_time_string(mem_ctx, finfo->all_info.out.access_time));
+ d_printf("\twrite_time: %s\n", nt_time_string(mem_ctx, finfo->all_info.out.write_time));
+ d_printf("\tchange_time: %s\n", nt_time_string(mem_ctx, finfo->all_info.out.change_time));
d_printf("\tattrib: 0x%x\n", finfo->all_info.out.attrib);
d_printf("\talloc_size: %llu\n", (unsigned long long)finfo->all_info.out.alloc_size);
d_printf("\tsize: %llu\n", (unsigned long long)finfo->all_info.out.size);