diff options
author | Gerald Carter <jerry@samba.org> | 2003-04-15 19:51:17 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2003-04-15 19:51:17 +0000 |
commit | d15cd357c702aaad4093f770d557b61a4e12f3a0 (patch) | |
tree | 921d2f4cd5a42165ab1be9d4759b14bc2c945e97 /source3 | |
parent | f7792732e66b7fc9a6ef4a07ea35b3a2e50f3f69 (diff) | |
download | samba-d15cd357c702aaad4093f770d557b61a4e12f3a0.tar.gz samba-d15cd357c702aaad4093f770d557b61a4e12f3a0.tar.bz2 samba-d15cd357c702aaad4093f770d557b61a4e12f3a0.zip |
merge in metze' smbcquotas patch from HEAD
(This used to be commit b6a77048886151435a4a5eeb9a04be44d397c504)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/Makefile.in | 25 | ||||
-rw-r--r-- | source3/bin/.cvsignore | 1 | ||||
-rw-r--r-- | source3/include/smb.h | 67 | ||||
-rw-r--r-- | source3/include/trans2.h | 6 | ||||
-rw-r--r-- | source3/lib/util_str.c | 6 | ||||
-rw-r--r-- | source3/libsmb/clifile.c | 17 | ||||
-rw-r--r-- | source3/libsmb/cliquota.c | 10 | ||||
-rw-r--r-- | source3/python/py_smb.c | 4 | ||||
-rw-r--r-- | source3/torture/nbio.c | 4 |
9 files changed, 88 insertions, 52 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in index 744194ce4a..81ed00e721 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -122,7 +122,8 @@ BIN_PROGS1 = bin/smbclient@EXEEXT@ bin/net@EXEEXT@ bin/smbspool@EXEEXT@ \ BIN_PROGS2 = bin/smbcontrol@EXEEXT@ bin/smbtree@EXEEXT@ bin/tdbbackup@EXEEXT@ \ bin/nmblookup@EXEEXT@ bin/pdbedit@EXEEXT@ BIN_PROGS3 = bin/smbpasswd@EXEEXT@ bin/rpcclient@EXEEXT@ bin/smbcacls@EXEEXT@ \ - bin/profiles@EXEEXT@ bin/smbgroupedit@EXEEXT@ bin/ntlm_auth@EXEEXT@ + bin/profiles@EXEEXT@ bin/smbgroupedit@EXEEXT@ bin/ntlm_auth@EXEEXT@ \ + bin/smbcquotas@EXEEXT@ TORTURE_PROGS = bin/smbtorture@EXEEXT@ bin/msgtest@EXEEXT@ \ bin/masktest@EXEEXT@ bin/locktest@EXEEXT@ \ @@ -207,6 +208,7 @@ LIBSMB_OBJ = libsmb/clientgen.o libsmb/cliconnect.o libsmb/clifile.o \ libsmb/clireadwrite.o libsmb/clilist.o libsmb/cliprint.o \ libsmb/clitrans.o libsmb/clisecdesc.o libsmb/clidgram.o \ libsmb/clistr.o libsmb/smb_signing.o \ + libsmb/cliquota.o libsmb/clifsinfo.o \ libsmb/smberr.o libsmb/credentials.o libsmb/pwd_cache.o \ libsmb/clioplock.o libsmb/errormap.o libsmb/clirap2.o \ libsmb/passchange.o libsmb/doserr.o \ @@ -500,6 +502,11 @@ SMBCACLS_OBJ = utils/smbcacls.o $(LOCKING_OBJ) $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) \ $(UBIQX_OBJ) $(LIB_OBJ) $(RPC_PARSE_OBJ) $(PASSDB_GET_SET_OBJ) \ $(LIBMSRPC_OBJ) $(SECRETS_OBJ) $(POPT_LIB_OBJ) +SMBCQUOTAS_OBJ = utils/smbcquotas.o $(LOCKING_OBJ) $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) \ + $(PARAM_OBJ) $(UBIQX_OBJ) $(LIB_OBJ) $(RPC_PARSE_OBJ) $(PASSDB_GET_SET_OBJ) \ + $(LIBMSRPC_OBJ) $(SECRETS_OBJ) $(POPT_LIB_OBJ) + + TALLOCTORT_OBJ = lib/talloctort.o $(LIB_OBJ) $(PARAM_OBJ) $(UBIQX_OBJ) RPCTORTURE_OBJ = torture/rpctorture.o \ @@ -605,6 +612,8 @@ locktest : SHOWFLAGS bin/locktest@EXEEXT@ smbcacls : SHOWFLAGS bin/smbcacls@EXEEXT@ +smbcquotas : SHOWFLAGS bin/smbcquotas@EXEEXT@ + locktest2 : SHOWFLAGS bin/locktest2@EXEEXT@ rpctorture : SHOWFLAGS bin/rpctorture@EXEEXT@ @@ -796,6 +805,10 @@ bin/smbcacls@EXEEXT@: $(SMBCACLS_OBJ) @BUILD_POPT@ bin/.dummy @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(SMBCACLS_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) @BUILD_POPT@ +bin/smbcquotas@EXEEXT@: $(SMBCQUOTAS_OBJ) @BUILD_POPT@ bin/.dummy + @echo Linking $@ + @$(CC) $(FLAGS) -o $@ $(SMBCQUOTAS_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) @BUILD_POPT@ $(KRB5LIBS) + bin/locktest@EXEEXT@: $(LOCKTEST_OBJ) bin/.dummy @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(LOCKTEST_OBJ) $(LDFLAGS) $(LIBS) @@ -844,16 +857,16 @@ bin/smbwrapper.32.@SHLIBEXT@: $(PICOBJS32) bin/libsmbclient.@SHLIBEXT@: $(LIBSMBCLIENT_PICOBJS) @echo Linking libsmbclient shared library $@ - $(SHLD) $(LDSHFLAGS) -o $@ $(LIBSMBCLIENT_PICOBJS) $(LDFLAGS) $(LIBS) \ + @$(SHLD) $(LDSHFLAGS) -o $@ $(LIBSMBCLIENT_PICOBJS) $(LDFLAGS) $(LIBS) \ @SONAMEFLAG@`basename $@`.$(LIBSMBCLIENT_MAJOR) bin/libsmbclient.a: $(LIBSMBCLIENT_PICOBJS) @echo Linking libsmbclient non-shared library $@ - -$(AR) -rc $@ $(LIBSMBCLIENT_PICOBJS) + @-$(AR) -rc $@ $(LIBSMBCLIENT_PICOBJS) bin/libbigballofmud.@SHLIBEXT@: $(LIBBIGBALLOFMUD_PICOBJS) @echo Linking bigballofmud shared library $@ - $(SHLD) $(LDSHFLAGS) -o $@ $(LIBBIGBALLOFMUD_PICOBJS) $(LIBS) \ + @$(SHLD) $(LDSHFLAGS) -o $@ $(LIBBIGBALLOFMUD_PICOBJS) $(LIBS) \ @SONAMEFLAG@`basename $@`.$(LIBBIGBALLOFMUD_MAJOR) # It would be nice to build a static bigballofmud too, but when I try @@ -966,10 +979,10 @@ bin/ntlm_auth@EXEEXT@: $(NTLM_AUTH_OBJ) $(PARAM_OBJ) $(LIB_OBJ) \ bin/pam_smbpass.@SHLIBEXT@: $(PAM_SMBPASS_PICOOBJ) @echo "Linking shared library $@" - $(SHLD) $(LDSHFLAGS) -o $@ $(PAM_SMBPASS_PICOOBJ) -lpam $(DYNEXP) $(LIBS) -lc + @$(SHLD) $(LDSHFLAGS) -o $@ $(PAM_SMBPASS_PICOOBJ) -lpam $(DYNEXP) $(LIBS) -lc bin/libmsrpc.a: $(LIBMSRPC_PICOBJ) - -$(AR) -rc $@ $(LIBMSRPC_PICOBJ) + @-$(AR) -rc $@ $(LIBMSRPC_PICOBJ) bin/tdbbackup@EXEEXT@: $(TDBBACKUP_OBJ) bin/.dummy @echo Linking $@ diff --git a/source3/bin/.cvsignore b/source3/bin/.cvsignore index 2ca1f67685..f2e7ef0d41 100644 --- a/source3/bin/.cvsignore +++ b/source3/bin/.cvsignore @@ -47,3 +47,4 @@ vfstest wbinfo winbindd wrepld +smbcquotas diff --git a/source3/include/smb.h b/source3/include/smb.h index d8ca9bde05..24b0a1fcd9 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -237,6 +237,8 @@ typedef struct nttime_info #define MAXSUBAUTHS 15 /* max sub authorities in a SID */ #endif +#define SID_MAX_SIZE ((size_t)(8+(MAXSUBAUTHS*4))) + /* SID Types */ enum SID_NAME_USE { @@ -365,6 +367,7 @@ typedef struct SMB_STRUCT_STAT *statinfo; } smb_filename; +#include "fake_file.h" typedef struct files_struct { @@ -401,6 +404,8 @@ typedef struct files_struct char *fsp_name; } files_struct; +#include "ntquotas.h" + /* used to hold an arbitrary blob of data */ typedef struct data_blob { uint8 *data; @@ -971,21 +976,21 @@ struct bitmap { #define TRANSACT_WAITNAMEDPIPEHANDLESTATE 0x53 /* These are the TRANS2 sub commands */ -#define TRANSACT2_OPEN 0 -#define TRANSACT2_FINDFIRST 1 -#define TRANSACT2_FINDNEXT 2 -#define TRANSACT2_QFSINFO 3 -#define TRANSACT2_SETFSINFO 4 -#define TRANSACT2_QPATHINFO 5 -#define TRANSACT2_SETPATHINFO 6 -#define TRANSACT2_QFILEINFO 7 -#define TRANSACT2_SETFILEINFO 8 -#define TRANSACT2_FSCTL 9 -#define TRANSACT2_IOCTL 0xA -#define TRANSACT2_FINDNOTIFYFIRST 0xB -#define TRANSACT2_FINDNOTIFYNEXT 0xC -#define TRANSACT2_MKDIR 0xD -#define TRANSACT2_SESSION_SETUP 0xE +#define TRANSACT2_OPEN 0x00 +#define TRANSACT2_FINDFIRST 0x01 +#define TRANSACT2_FINDNEXT 0x02 +#define TRANSACT2_QFSINFO 0x03 +#define TRANSACT2_SETFSINFO 0x04 +#define TRANSACT2_QPATHINFO 0x05 +#define TRANSACT2_SETPATHINFO 0x06 +#define TRANSACT2_QFILEINFO 0x07 +#define TRANSACT2_SETFILEINFO 0x08 +#define TRANSACT2_FSCTL 0x09 +#define TRANSACT2_IOCTL 0x0A +#define TRANSACT2_FINDNOTIFYFIRST 0x0B +#define TRANSACT2_FINDNOTIFYNEXT 0x0C +#define TRANSACT2_MKDIR 0x0D +#define TRANSACT2_SESSION_SETUP 0x0E #define TRANSACT2_GET_DFS_REFERRAL 0x10 #define TRANSACT2_REPORT_DFS_INCONSISTANCY 0x11 @@ -996,6 +1001,13 @@ struct bitmap { #define NT_TRANSACT_NOTIFY_CHANGE 4 #define NT_TRANSACT_RENAME 5 #define NT_TRANSACT_QUERY_SECURITY_DESC 6 +#define NT_TRANSACT_GET_USER_QUOTA 7 +#define NT_TRANSACT_SET_USER_QUOTA 8 + +/* These are the NT transact_get_user_quota sub commands */ +#define TRANSACT_GET_USER_QUOTA_LIST_CONTINUE 0x0000 +#define TRANSACT_GET_USER_QUOTA_LIST_START 0x0100 +#define TRANSACT_GET_USER_QUOTA_FOR_SID 0x0101 /* Relevant IOCTL codes */ #define IOCTL_QUERY_JOB_INFO 0x530060 @@ -1236,18 +1248,23 @@ struct bitmap { #define RENAME_REPLACE_IF_EXISTS 1 /* Filesystem Attributes. */ -#define FILE_CASE_SENSITIVE_SEARCH 0x01 -#define FILE_CASE_PRESERVED_NAMES 0x02 -#define FILE_UNICODE_ON_DISK 0x04 +#define FILE_CASE_SENSITIVE_SEARCH 0x00000001 +#define FILE_CASE_PRESERVED_NAMES 0x00000002 +#define FILE_UNICODE_ON_DISK 0x00000004 /* According to cifs9f, this is 4, not 8 */ /* Acconding to testing, this actually sets the security attribute! */ -#define FILE_PERSISTENT_ACLS 0x08 -/* These entries added from cifs9f --tsb */ -#define FILE_FILE_COMPRESSION 0x10 -#define FILE_VOLUME_QUOTAS 0x20 -/* I think this is wrong. JRA #define FILE_DEVICE_IS_MOUNTED 0x20 */ -#define FILE_VOLUME_SPARSE_FILE 0x40 -#define FILE_VOLUME_IS_COMPRESSED 0x8000 +#define FILE_PERSISTENT_ACLS 0x00000008 +#define FILE_FILE_COMPRESSION 0x00000010 +#define FILE_VOLUME_QUOTAS 0x00000020 +#define FILE_SUPPORTS_SPARSE_FILES 0x00000040 +#define FILE_SUPPORTS_REPARSE_POINTS 0x00000080 +#define FILE_SUPPORTS_REMOTE_STORAGE 0x00000100 +#define FS_LFN_APIS 0x00004000 +#define FILE_VOLUME_IS_COMPRESSED 0x00008000 +#define FILE_SUPPORTS_OBJECT_IDS 0x00010000 +#define FILE_SUPPORTS_ENCRYPTION 0x00020000 +#define FILE_NAMED_STREAMS 0x00040000 +#define FILE_READ_ONLY_VOLUME 0x00080000 /* ChangeNotify flags. */ #define FILE_NOTIFY_CHANGE_FILE 0x001 diff --git a/source3/include/trans2.h b/source3/include/trans2.h index 3468d3b995..2ccf83478b 100644 --- a/source3/include/trans2.h +++ b/source3/include/trans2.h @@ -206,7 +206,9 @@ Byte offset Type name description #define SMB_QUERY_FS_SIZE_INFO 0x103 #define SMB_QUERY_FS_DEVICE_INFO 0x104 #define SMB_QUERY_FS_ATTRIBUTE_INFO 0x105 - +#if 0 +#define SMB_QUERY_FS_QUOTA_INFO +#endif #define l2_vol_fdateCreation 0 #define l2_vol_cch 4 @@ -320,7 +322,7 @@ Byte offset Type name description #define SMB_FS_SIZE_INFORMATION 1003 #define SMB_FS_DEVICE_INFORMATION 1004 #define SMB_FS_ATTRIBUTE_INFORMATION 1005 -#define SMB_FS_CONTROL_INFORMATION 1006 +#define SMB_FS_QUOTA_INFORMATION 1006 #define SMB_FS_FULL_SIZE_INFORMATION 1007 #define SMB_FS_OBJECTID_INFORMATION 1008 diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index e2f9f19f58..e561d15f61 100644 --- a/source3/lib/util_str.c +++ b/source3/lib/util_str.c @@ -1226,12 +1226,12 @@ char *binary_string(char *buf, int len) return ret; } -#if 0 + /** Just a typesafety wrapper for snprintf into a fstring. **/ -static int fstr_sprintf(fstring s, const char *fmt, ...) +int fstr_sprintf(fstring s, const char *fmt, ...) { va_list ap; int ret; @@ -1241,7 +1241,7 @@ static int fstr_sprintf(fstring s, const char *fmt, ...) va_end(ap); return ret; } -#endif + #ifndef HAVE_STRNDUP /** diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c index d86f36405d..1163b752b1 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -375,9 +375,11 @@ int cli_nt_delete_on_close(struct cli_state *cli, int fnum, BOOL flag) Used in smbtorture. ****************************************************************************/ -int cli_nt_create_full(struct cli_state *cli, const char *fname, uint32 DesiredAccess, +int cli_nt_create_full(struct cli_state *cli, const char *fname, + uint32 CreatFlags, uint32 DesiredAccess, uint32 FileAttributes, uint32 ShareAccess, - uint32 CreateDisposition, uint32 CreateOptions) + uint32 CreateDisposition, uint32 CreateOptions, + uint8 SecuityFlags) { char *p; int len; @@ -393,9 +395,9 @@ int cli_nt_create_full(struct cli_state *cli, const char *fname, uint32 DesiredA SSVAL(cli->outbuf,smb_vwv0,0xFF); if (cli->use_oplocks) - SIVAL(cli->outbuf,smb_ntcreate_Flags, REQUEST_OPLOCK|REQUEST_BATCH_OPLOCK); - else - SIVAL(cli->outbuf,smb_ntcreate_Flags, 0); + CreatFlags |= (REQUEST_OPLOCK|REQUEST_BATCH_OPLOCK); + + SIVAL(cli->outbuf,smb_ntcreate_Flags, CreatFlags); SIVAL(cli->outbuf,smb_ntcreate_RootDirectoryFid, 0x0); SIVAL(cli->outbuf,smb_ntcreate_DesiredAccess, DesiredAccess); SIVAL(cli->outbuf,smb_ntcreate_FileAttributes, FileAttributes); @@ -403,6 +405,7 @@ int cli_nt_create_full(struct cli_state *cli, const char *fname, uint32 DesiredA SIVAL(cli->outbuf,smb_ntcreate_CreateDisposition, CreateDisposition); SIVAL(cli->outbuf,smb_ntcreate_CreateOptions, CreateOptions); SIVAL(cli->outbuf,smb_ntcreate_ImpersonationLevel, 0x02); + SCVAL(cli->outbuf,smb_ntcreate_SecurityFlags, SecuityFlags); p = smb_buf(cli->outbuf); /* this alignment and termination is critical for netapp filers. Don't change */ @@ -433,8 +436,8 @@ int cli_nt_create_full(struct cli_state *cli, const char *fname, uint32 DesiredA int cli_nt_create(struct cli_state *cli, const char *fname, uint32 DesiredAccess) { - return cli_nt_create_full(cli, fname, DesiredAccess, 0, - FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_EXISTS_OPEN, 0x0); + return cli_nt_create_full(cli, fname, 0, DesiredAccess, 0, + FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_EXISTS_OPEN, 0x0, 0x0); } /**************************************************************************** diff --git a/source3/libsmb/cliquota.c b/source3/libsmb/cliquota.c index ed808aa1f5..a56a6bd674 100644 --- a/source3/libsmb/cliquota.c +++ b/source3/libsmb/cliquota.c @@ -85,7 +85,7 @@ static BOOL parse_user_quota_record(const char *rdata, unsigned int rdata_count, #else /* LARGE_SMB_OFF_T */ if ((IVAL(rdata,20) != 0)&& ((qt.usedspace != 0xFFFFFFFF)|| - (IVAL(rdata,20)!=0xFFFFFFFF))) { + (IVAL(rdata,20)!=0xFFFFFFFF)))) { /* more than 32 bits? */ return False; } @@ -98,7 +98,7 @@ static BOOL parse_user_quota_record(const char *rdata, unsigned int rdata_count, #else /* LARGE_SMB_OFF_T */ if ((IVAL(rdata,28) != 0)&& ((qt.softlim != 0xFFFFFFFF)|| - (IVAL(rdata,28)!=0xFFFFFFFF))) { + (IVAL(rdata,28)!=0xFFFFFFFF)))) { /* more than 32 bits? */ return False; } @@ -111,7 +111,7 @@ static BOOL parse_user_quota_record(const char *rdata, unsigned int rdata_count, #else /* LARGE_SMB_OFF_T */ if ((IVAL(rdata,36) != 0)&& ((qt.hardlim != 0xFFFFFFFF)|| - (IVAL(rdata,36)!=0xFFFFFFFF))) { + (IVAL(rdata,36)!=0xFFFFFFFF)))) { /* more than 32 bits? */ return False; } @@ -459,7 +459,7 @@ BOOL cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_ST #else /* LARGE_SMB_OFF_T */ if ((IVAL(rdata,28) != 0)&& ((qt.softlim != 0xFFFFFFFF)|| - (IVAL(rdata,28)!=0xFFFFFFFF))) { + (IVAL(rdata,28)!=0xFFFFFFFF)))) { /* more than 32 bits? */ goto cleanup; } @@ -472,7 +472,7 @@ BOOL cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_ST #else /* LARGE_SMB_OFF_T */ if ((IVAL(rdata,36) != 0)&& ((qt.hardlim != 0xFFFFFFFF)|| - (IVAL(rdata,36)!=0xFFFFFFFF))) { + (IVAL(rdata,36)!=0xFFFFFFFF)))) { /* more than 32 bits? */ goto cleanup; } diff --git a/source3/python/py_smb.c b/source3/python/py_smb.c index 8d81176e4d..d37b73cceb 100644 --- a/source3/python/py_smb.c +++ b/source3/python/py_smb.c @@ -165,8 +165,8 @@ static PyObject *py_smb_nt_create_andx(PyObject *self, PyObject *args, return NULL; result = cli_nt_create_full( - cli->cli, filename, desired_access, file_attributes, - share_access, create_disposition, create_options); + cli->cli, filename, 0, desired_access, file_attributes, + share_access, create_disposition, create_options, 0); if (cli_is_error(cli->cli)) { PyErr_SetString(PyExc_RuntimeError, "nt_create_andx failed"); diff --git a/source3/torture/nbio.c b/source3/torture/nbio.c index 2d519b40ba..d8d3ca0c09 100644 --- a/source3/torture/nbio.c +++ b/source3/torture/nbio.c @@ -148,12 +148,12 @@ void nb_createx(char *fname, desired_access = FILE_READ_DATA | FILE_WRITE_DATA; } - fd = cli_nt_create_full(c, fname, + fd = cli_nt_create_full(c, fname, 0, desired_access, 0x0, FILE_SHARE_READ|FILE_SHARE_WRITE, create_disposition, - create_options); + create_options, 0); if (fd == -1 && handle != -1) { printf("ERROR: cli_nt_create_full failed for %s - %s\n", fname, cli_errstr(c)); |