diff options
Diffstat (limited to 'source/include')
-rw-r--r-- | source/include/config.h.in | 30 | ||||
-rw-r--r-- | source/include/doserr.h | 1 | ||||
-rw-r--r-- | source/include/includes.h | 27 | ||||
-rw-r--r-- | source/include/nameserv.h | 7 | ||||
-rw-r--r-- | source/include/proto.h | 41 | ||||
-rw-r--r-- | source/include/rpc_samr.h | 13 | ||||
-rw-r--r-- | source/include/samba_linux_quota.h | 490 | ||||
-rw-r--r-- | source/include/smb.h | 22 | ||||
-rw-r--r-- | source/include/trans2.h | 7 | ||||
-rw-r--r-- | source/include/version.h | 2 |
10 files changed, 602 insertions, 38 deletions
diff --git a/source/include/config.h.in b/source/include/config.h.in index b4f454ec3fc..3a1db41954b 100644 --- a/source/include/config.h.in +++ b/source/include/config.h.in @@ -85,6 +85,7 @@ #undef HAVE_CONNECT #undef HAVE_SHORT_INO_T #undef WITH_SMBWRAPPER +#undef WITH_WINBIND_AUTH_CRAP #undef WITH_AFS #undef WITH_DFS #undef SUNOS5 @@ -125,9 +126,6 @@ #undef WITH_SYSLOG #undef WITH_PROFILE #undef WITH_SSL -#undef WITH_LDAP -#undef WITH_NISPLUS -#undef WITH_TDBPWD #undef WITH_PAM #undef WITH_PAM_SMBPASS #undef WITH_NISPLUS_HOME @@ -138,12 +136,11 @@ #undef REPLACE_INET_NTOA #undef HAVE_FILE_MACRO #undef HAVE_FUNCTION_MACRO +#undef HAVE_VA_COPY #undef HAVE_SETRESUID_DECL #undef HAVE_SETRESUID -#undef WITH_NETATALK #undef WITH_UTMP #undef WITH_MSDFS -#undef WITH_VFS #undef HAVE_INO64_T #undef HAVE_DEV64_T #undef HAVE_STRUCT_FLOCK64 @@ -243,6 +240,8 @@ #undef HAVE_DEVICE_MINOR_FN #undef HAVE_MAKEDEV_FN #undef HAVE_GETGROUPS_TOO_MANY_EGIDS +#undef HAVE_PASSWD_PW_COMMENT +#undef HAVE_PASSWD_PW_AGE /* * Add these definitions to allow VFS modules to * see the CPPFLAGS defines. @@ -632,6 +631,9 @@ /* Define if you have the innetgr function. */ #undef HAVE_INNETGR +/* Define if you have the ldap_start_tls_s function. */ +#undef HAVE_LDAP_START_TLS_S + /* Define if you have the link function. */ #undef HAVE_LINK @@ -794,6 +796,12 @@ /* Define if you have the strlcpy function. */ #undef HAVE_STRLCPY +/* Define if you have the strndup function. */ +#undef HAVE_STRNDUP + +/* Define if you have the strnlen function. */ +#undef HAVE_STRNLEN + /* Define if you have the strpbrk function. */ #undef HAVE_STRPBRK @@ -851,12 +859,6 @@ /* Define if you have the <ctype.h> header file. */ #undef HAVE_CTYPE_H -/* Define if you have the <cups/cups.h> header file. */ -#undef HAVE_CUPS_CUPS_H - -/* Define if you have the <cups/language.h> header file. */ -#undef HAVE_CUPS_LANGUAGE_H - /* Define if you have the <dirent.h> header file. */ #undef HAVE_DIRENT_H @@ -992,6 +994,9 @@ /* Define if you have the <sys/fcntl.h> header file. */ #undef HAVE_SYS_FCNTL_H +/* Define if you have the <sys/file.h> header file. */ +#undef HAVE_SYS_FILE_H + /* Define if you have the <sys/filio.h> header file. */ #undef HAVE_SYS_FILIO_H @@ -1103,9 +1108,6 @@ /* Define if you have the acl library (-lacl). */ #undef HAVE_LIBACL -/* Define if you have the cups library (-lcups). */ -#undef HAVE_LIBCUPS - /* Define if you have the gen library (-lgen). */ #undef HAVE_LIBGEN diff --git a/source/include/doserr.h b/source/include/doserr.h index ca0baa307d7..783af7e7961 100644 --- a/source/include/doserr.h +++ b/source/include/doserr.h @@ -165,6 +165,7 @@ #define WERR_OBJECT_PATH_INVALID W_ERROR(161) #define WERR_NO_MORE_ITEMS W_ERROR(259) #define WERR_MORE_DATA W_ERROR(234) +#define WERR_CAN_NOT_COMPLETE W_ERROR(1003) #define WERR_INVALID_SECURITY_DESCRIPTOR W_ERROR(1338) #define WERR_UNKNOWN_PRINTER_DRIVER W_ERROR(1797) #define WERR_INVALID_PRINTER_NAME W_ERROR(1801) diff --git a/source/include/includes.h b/source/include/includes.h index f8dcee4aab5..74f9c4af257 100644 --- a/source/include/includes.h +++ b/source/include/includes.h @@ -208,7 +208,9 @@ #ifdef HAVE_SYSLOG_H #include <syslog.h> #endif +#ifdef HAVE_SYS_FILE_H #include <sys/file.h> +#endif #ifdef HAVE_NETINET_TCP_H #include <netinet/tcp.h> @@ -388,8 +390,12 @@ /* * Define additional missing types */ -#ifndef HAVE_SIG_ATOMIC_T_TYPE -typedef int sig_atomic_t; +#if defined(HAVE_SIG_ATOMIC_T_TYPE) && defined(AIX) +typedef sig_atomic_t SIG_ATOMIC_T; +#elif defined(HAVE_SIG_ATOMIC_T_TYPE) && !defined(AIX) +typedef sig_atomic_t VOLATILE SIG_ATOMIC_T; +#else +typedef int VOLATILE SIG_ATOMIC_T; #endif #ifndef HAVE_SOCKLEN_T_TYPE @@ -688,6 +694,8 @@ extern int errno; #include "popt.h" +#include "mangle.h" + #ifndef MAXCODEPAGELINES #define MAXCODEPAGELINES 256 #endif @@ -875,6 +883,14 @@ size_t strlcat(char *d, const char *s, size_t bufsize); int ftruncate(int f,long l); #endif +#ifndef HAVE_STRNDUP +char *strndup(const char *s, size_t n); +#endif + +#ifndef HAVE_STRNLEN +size_t strnlen(const char *s, size_t n); +#endif + #ifndef HAVE_STRTOUL unsigned long strtoul(const char *nptr, char **endptr, int base); #endif @@ -1072,5 +1088,12 @@ int asprintf(char **,const char *, ...) PRINTF_ATTRIBUTE(2,3); #define slprintf snprintf #define vslprintf vsnprintf +/* we need to use __va_copy() on some platforms */ +#ifdef HAVE_VA_COPY +#define VA_COPY(dest, src) __va_copy(dest, src) +#else +#define VA_COPY(dest, src) (dest) = (src) +#endif + #endif /* _INCLUDES_H */ diff --git a/source/include/nameserv.h b/source/include/nameserv.h index 49b6f1d3aac..91e88ee6b1c 100644 --- a/source/include/nameserv.h +++ b/source/include/nameserv.h @@ -421,6 +421,13 @@ struct res_rec { char rdata[MAX_DGRAM_SIZE]; }; +#define NM_FLAGS_RS 0x80 /* Response. Cheat */ +#define NM_FLAGS_AA 0x40 /* Authoritative */ +#define NM_FLAGS_TC 0x20 /* Truncated */ +#define NM_FLAGS_RD 0x10 /* Recursion Desired */ +#define NM_FLAGS_RA 0x08 /* Recursion Available */ +#define NM_FLAGS_B 0x01 /* Broadcast */ + /* An nmb packet. */ struct nmb_packet { diff --git a/source/include/proto.h b/source/include/proto.h index 81db73a6926..e99cb580901 100644 --- a/source/include/proto.h +++ b/source/include/proto.h @@ -56,7 +56,7 @@ char* debug_classname_from_index(int ndx); int debug_lookup_classname(char* classname); BOOL debug_parse_params(char **params, int *debuglevel_class); BOOL debug_parse_levels(char *params_str); -void debug_message(int msg_level, pid_t src, void *buf, size_t len); +void debug_message(int msg_type, pid_t src, void *buf, size_t len); void debug_message_send(pid_t pid, int level); void setup_logging(char *pname, BOOL interactive); BOOL reopen_logs( void ); @@ -139,7 +139,7 @@ BOOL message_send_all(TDB_CONTEXT *conn_tdb, int msg_type, const void *buf, size_t len, BOOL duplicates_allowed, int *n_sent); -BOOL message_named_mutex(char *name, unsigned int timeout); +BOOL message_named_mutex(const char *name, unsigned int timeout); void message_named_mutex_release(char *name); /* The following definitions come from lib/ms_fnmatch.c */ @@ -697,7 +697,7 @@ BOOL name_register(int fd, const char *name, int name_type, struct in_addr to_ip, int *count); struct in_addr *name_query(int fd,const char *name,int name_type, BOOL bcast,BOOL recurse, - struct in_addr to_ip, int *count); + struct in_addr to_ip, int *count, int *flags); FILE *startlmhosts(char *fname); BOOL getlmhostsent( FILE *fp, pstring name, int *name_type, struct in_addr *ipaddr); void endlmhosts(FILE *fp); @@ -705,6 +705,7 @@ BOOL name_register_wins(const char *name, int name_type); BOOL name_resolve_bcast(const char *name, int name_type, struct in_addr **return_ip_list, int *return_count); BOOL resolve_name(const char *name, struct in_addr *return_ip, int name_type); +BOOL resolve_name_2(const char *name, struct in_addr **return_ip, int *count, int name_type); BOOL resolve_srv_name(const char* srv_name, fstring dest_host, struct in_addr *ip); BOOL find_master_ip(char *group, struct in_addr *master_ip); @@ -1348,8 +1349,8 @@ char *dos_unistr2(uint16 *src); char *dos_unistr2_to_str(UNISTR2 *str); void ascii_to_unistr(uint16 *dest, const char *src, int maxlen); void unistr_to_ascii(char *dest, const uint16 *src, int len); -void unistr2_to_ascii(char *dest, const UNISTR2 *str, size_t maxlen); -char *unistr2_tdup(TALLOC_CTX *ctx, const UNISTR2 *str); +void unistr2_to_dos(char *dest, const UNISTR2 *str, size_t maxlen); +void unistr2_to_unix(char *dest, const UNISTR2 *str, size_t maxlen); uint32 buffer2_to_uint32(BUFFER2 *str); char *dos_buffer2_to_str(BUFFER2 *str); char *dos_buffer2_to_multistr(BUFFER2 *str); @@ -1944,6 +1945,7 @@ int lp_ldap_ssl(void); char *lp_add_share_cmd(void); char *lp_change_share_cmd(void); char *lp_delete_share_cmd(void); +char *lp_mangling_method(void); int lp_ssl_version(void); char *lp_ssl_hosts(void); char *lp_ssl_hosts_resign(void); @@ -2122,6 +2124,7 @@ BOOL lp_inherit_acls(int ); BOOL lp_use_client_driver(int ); BOOL lp_default_devmode(int ); BOOL lp_nt_acl_support(int ); +BOOL lp_force_unknown_acl_user(int ); int lp_create_mask(int ); int lp_force_create_mode(int ); int lp_security_mask(int ); @@ -2406,6 +2409,7 @@ void free_nt_devicemode(NT_DEVICEMODE **devmode_ptr); void get_printer_subst_params(int snum, fstring *printername, fstring *sharename, fstring *portname); WERROR mod_a_printer(NT_PRINTER_INFO_LEVEL printer, uint32 level); BOOL set_driver_init(NT_PRINTER_INFO_LEVEL *printer, uint32 level); +BOOL del_driver_init(char *drivername); uint32 update_driver_init(NT_PRINTER_INFO_LEVEL printer, uint32 level); WERROR save_driver_init(NT_PRINTER_INFO_LEVEL *printer, uint32 level, NT_PRINTER_PARAM *param); WERROR get_a_printer(NT_PRINTER_INFO_LEVEL **pp_printer, uint32 level, fstring sharename); @@ -4425,12 +4429,24 @@ int api_reply(connection_struct *conn,uint16 vuid,char *outbuf,char *data,char * /* The following definitions come from smbd/mangle.c */ -BOOL is_mangled( char *s ); -BOOL is_8_3( char *fname, BOOL check_case ); -void reset_mangled_cache( void ); -BOOL check_mangled_cache( char *s ); -void mangle_name_83( char *s); -BOOL name_map_mangle(char *OutName, BOOL need83, BOOL cache83, int snum); +void mangle_reset_cache(void); +BOOL mangle_is_mangled(const char *s); +BOOL mangle_is_8_3(const char *fname, BOOL check_case); +BOOL mangle_is_8_3_wildcards(const char *fname, BOOL check_case); +BOOL mangle_check_cache(char *s); +void mangle_map(char *OutName, BOOL need83, BOOL cache83, int snum); + +/* The following definitions come from smbd/mangle_hash2.c */ + +struct mangle_fns *mangle_hash2_init(void); + +/* The following definitions come from smbd/mangle_hash.c */ + +struct mangle_fns *mangle_hash_init(void); + +/* The following definitions come from smbd/mangle_map.c */ + +void mangle_map_filename(char *fname, int snum); /* The following definitions come from smbd/message.c */ @@ -4501,7 +4517,7 @@ BOOL check_file_sharing(connection_struct *conn,char *fname, BOOL rename_op); int32 get_number_of_exclusive_open_oplocks(void); BOOL oplock_message_waiting(fd_set *fds); -BOOL receive_local_message(fd_set *fds, char *buffer, int buffer_len, int timeout); +BOOL receive_local_message( char *buffer, int buffer_len, int timeout); BOOL set_file_oplock(files_struct *fsp, int oplock_type); void release_file_oplock(files_struct *fsp); BOOL remove_oplock(files_struct *fsp, BOOL break_to_none); @@ -4706,6 +4722,7 @@ BOOL reset_stat_cache( void ); /* The following definitions come from smbd/trans2.c */ +time_t interpret_long_unix_date(char *p); NTSTATUS set_bad_path_error(int err, BOOL bad_path); NTSTATUS set_delete_on_close_internal(files_struct *fsp, BOOL delete_on_close); int reply_findclose(connection_struct *conn, char *inbuf,char *outbuf,int length,int bufsize); diff --git a/source/include/rpc_samr.h b/source/include/rpc_samr.h index 59325ca88d4..7e515ec275b 100644 --- a/source/include/rpc_samr.h +++ b/source/include/rpc_samr.h @@ -1694,9 +1694,16 @@ typedef struct q_samr_get_dom_pwinfo /* SAMR_R_GET_DOM_PWINFO */ typedef struct r_samr_get_dom_pwinfo { - uint16 unk_0; - uint16 unk_1; - uint16 unk_2; + /* + * Previously this was 3 uint16's. However, after some tests + * it appears that the data len for the signing needs to be 16. + * Not sure how 3 unit16's ever worked since the length always + * turned out to 12. 3 uint32's + NT_STATUS == 16 bytes. Tested + * using NT and 2k. --jerry + */ + uint32 unk_0; + uint32 unk_1; + uint32 unk_2; NTSTATUS status; } SAMR_R_GET_DOM_PWINFO; diff --git a/source/include/samba_linux_quota.h b/source/include/samba_linux_quota.h new file mode 100644 index 00000000000..d5ba1199ef1 --- /dev/null +++ b/source/include/samba_linux_quota.h @@ -0,0 +1,490 @@ +#ifndef _SAMBA_LINUX_QUOTA_H_ + +/* + Unix SMB/Netbios implementation. + Version 2.x + Copyright (C) Andrew Tridgell 1994-2002 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +/* + This file is needed because Quota support on Linux has + been broken since Linus kernel 2.4.x. It will only get + better (and this file be removed) when all the distributions + ship a glibc with a working quota.h file. This is very + bad. JRA. + + Original file came from Christoph Hellwig <hch@infradead.org>. + Massaged into one nasty include file (to stop us having to + add multiple files into Samba just for Linux braindamage) + by JRA. +*/ + +#ifndef _QUOTAIO_LINUX_V1 +#define _QUOTAIO_LINUX_V1 + +/* + * Headerfile for old quotafile format + */ + +#include <sys/types.h> + +#define V1_DQBLK_SIZE_BITS 10 +#define V1_DQBLK_SIZE (1 << V1_DQBLK_SIZE_BITS) /* Size of one quota block in bytes in old format */ + +#define V1_DQOFF(__id) ((loff_t) ((__id) * sizeof(struct v1_disk_dqblk))) + +/* Structure of quota on disk */ +struct v1_disk_dqblk { + u_int32_t dqb_bhardlimit; /* absolute limit on disk blks alloc */ + u_int32_t dqb_bsoftlimit; /* preferred limit on disk blks */ + u_int32_t dqb_curblocks; /* current block count */ + u_int32_t dqb_ihardlimit; /* maximum # allocated inodes */ + u_int32_t dqb_isoftlimit; /* preferred limit on inodes */ + u_int32_t dqb_curinodes; /* current # allocated inodes */ + time_t dqb_btime; /* time limit for excessive disk use */ + time_t dqb_itime; /* time limit for excessive files */ +} __attribute__ ((packed)); + +/* Structure used for communication with kernel */ +struct v1_kern_dqblk { + u_int32_t dqb_bhardlimit; /* absolute limit on disk blks alloc */ + u_int32_t dqb_bsoftlimit; /* preferred limit on disk blks */ + u_int32_t dqb_curblocks; /* current block count */ + u_int32_t dqb_ihardlimit; /* maximum # allocated inodes */ + u_int32_t dqb_isoftlimit; /* preferred inode limit */ + u_int32_t dqb_curinodes; /* current # allocated inodes */ + time_t dqb_btime; /* time limit for excessive disk use */ + time_t dqb_itime; /* time limit for excessive files */ +}; + +struct v1_dqstats { + u_int32_t lookups; + u_int32_t drops; + u_int32_t reads; + u_int32_t writes; + u_int32_t cache_hits; + u_int32_t allocated_dquots; + u_int32_t free_dquots; + u_int32_t syncs; +}; + +#ifndef Q_V1_GETQUOTA +#define Q_V1_GETQUOTA 0x300 +#endif + +#endif /* _QUOTAIO_LINUX_V1 */ + +/* + * + * Header file for disk format of new quotafile format + * + */ + +#ifndef _QUOTAIO_LINUX_V2 +#define _QUOTAIO_LINUX_V2 + +#include <sys/types.h> + +#ifndef _QUOTA_LINUX +#define _QUOTA_LINUX + +#include <sys/types.h> + +typedef u_int32_t qid_t; /* Type in which we store ids in memory */ +typedef u_int64_t qsize_t; /* Type in which we store size limitations */ + +#define MAXQUOTAS 2 +#define USRQUOTA 0 /* element used for user quotas */ +#define GRPQUOTA 1 /* element used for group quotas */ + +/* + * Definitions for the default names of the quotas files. + */ +#define INITQFNAMES { \ + "user", /* USRQUOTA */ \ + "group", /* GRPQUOTA */ \ + "undefined", \ +} + +/* + * Definitions of magics and versions of current quota files + */ +#define INITQMAGICS {\ + 0xd9c01f11, /* USRQUOTA */\ + 0xd9c01927 /* GRPQUOTA */\ +} + +/* Size of blocks in which are counted size limits in generic utility parts */ +#define QUOTABLOCK_BITS 10 +#define QUOTABLOCK_SIZE (1 << QUOTABLOCK_BITS) + +/* Conversion routines from and to quota blocks */ +#define qb2kb(x) ((x) << (QUOTABLOCK_BITS-10)) +#define kb2qb(x) ((x) >> (QUOTABLOCK_BITS-10)) +#define toqb(x) (((x) + QUOTABLOCK_SIZE - 1) >> QUOTABLOCK_BITS) + +/* + * Command definitions for the 'quotactl' system call. + * The commands are broken into a main command defined below + * and a subcommand that is used to convey the type of + * quota that is being manipulated (see above). + */ +#define SUBCMDMASK 0x00ff +#define SUBCMDSHIFT 8 +#define QCMD(cmd, type) (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK)) + +#define Q_6_5_QUOTAON 0x0100 /* enable quotas */ +#define Q_6_5_QUOTAOFF 0x0200 /* disable quotas */ +#define Q_6_5_SYNC 0x0600 /* sync disk copy of a filesystems quotas */ + +#define Q_SYNC 0x800001 /* sync disk copy of a filesystems quotas */ +#define Q_QUOTAON 0x800002 /* turn quotas on */ +#define Q_QUOTAOFF 0x800003 /* turn quotas off */ +#define Q_GETFMT 0x800004 /* get quota format used on given filesystem */ +#define Q_GETINFO 0x800005 /* get information about quota files */ +#define Q_SETINFO 0x800006 /* set information about quota files */ +#define Q_GETQUOTA 0x800007 /* get user quota structure */ +#define Q_SETQUOTA 0x800008 /* set user quota structure */ + +/* + * Quota structure used for communication with userspace via quotactl + * Following flags are used to specify which fields are valid + */ +#define QIF_BLIMITS 1 +#define QIF_SPACE 2 +#define QIF_ILIMITS 4 +#define QIF_INODES 8 +#define QIF_BTIME 16 +#define QIF_ITIME 32 +#define QIF_LIMITS (QIF_BLIMITS | QIF_ILIMITS) +#define QIF_USAGE (QIF_SPACE | QIF_INODES) +#define QIF_TIMES (QIF_BTIME | QIF_ITIME) +#define QIF_ALL (QIF_LIMITS | QIF_USAGE | QIF_TIMES) + +struct if_dqblk { + u_int64_t dqb_bhardlimit; + u_int64_t dqb_bsoftlimit; + u_int64_t dqb_curspace; + u_int64_t dqb_ihardlimit; + u_int64_t dqb_isoftlimit; + u_int64_t dqb_curinodes; + u_int64_t dqb_btime; + u_int64_t dqb_itime; + u_int32_t dqb_valid; +}; + +/* + * Structure used for setting quota information about file via quotactl + * Following flags are used to specify which fields are valid + */ +#define IIF_BGRACE 1 +#define IIF_IGRACE 2 +#define IIF_FLAGS 4 +#define IIF_ALL (IIF_BGRACE | IIF_IGRACE | IIF_FLAGS) + +struct if_dqinfo { + u_int64_t dqi_bgrace; + u_int64_t dqi_igrace; + u_int32_t dqi_flags; + u_int32_t dqi_valid; +}; + +/* Quota format identifiers */ +#define QFMT_VFS_OLD 1 +#define QFMT_VFS_V0 2 + +/* Flags supported by kernel */ +#define V1_DQF_RSQUASH 1 + +/* Ioctl for getting quota size */ +#include <sys/ioctl.h> +#ifndef FIOQSIZE + #if defined(__alpha__) || defined(__powerpc__) || defined(__sh__) || defined(__sparc__) || defined(__sparc64__) + #define FIOQSIZE _IOR('f', 128, loff_t) + #elif defined(__arm__) || defined(__mc68000__) || defined(__s390__) + #define FIOQSIZE 0x545E + #elif defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__ia64__) || defined(__parisc__) || defined(__cris__) || defined(__hppa__) + #define FIOQSIZE 0x5460 + #elif defined(__mips__) || defined(__mips64__) + #define FIOQSIZE 0x6667 + #endif +#endif + +long quotactl __P((int, const char *, qid_t, caddr_t)); + +#endif /* _QUOTA_LINUX */ + +#define V2_DQINFOOFF sizeof(struct v2_disk_dqheader) /* Offset of info header in file */ +#define V2_DQBLKSIZE_BITS 10 +#define V2_DQBLKSIZE (1 << V2_DQBLKSIZE_BITS) /* Size of block with quota structures */ +#define V2_DQTREEOFF 1 /* Offset of tree in file in blocks */ +#define V2_DQTREEDEPTH 4 /* Depth of quota tree */ +#define V2_DQSTRINBLK ((V2_DQBLKSIZE - sizeof(struct v2_disk_dqdbheader)) / sizeof(struct v2_disk_dqblk)) /* Number of entries in one blocks */ +#define V2_GETIDINDEX(id, depth) (((id) >> ((V2_DQTREEDEPTH-(depth)-1)*8)) & 0xff) +#define V2_GETENTRIES(buf) ((struct v2_disk_dqblk *)(((char *)(buf)) + sizeof(struct v2_disk_dqdbheader))) +#define INIT_V2_VERSIONS { 0, 0} + +struct v2_disk_dqheader { + u_int32_t dqh_magic; /* Magic number identifying file */ + u_int32_t dqh_version; /* File version */ +} __attribute__ ((packed)); + +/* Flags for version specific files */ +#define V2_DQF_MASK 0x0000 /* Mask for all valid ondisk flags */ + +/* Header with type and version specific information */ +struct v2_disk_dqinfo { + u_int32_t dqi_bgrace; /* Time before block soft limit becomes hard limit */ + u_int32_t dqi_igrace; /* Time before inode soft limit becomes hard limit */ + u_int32_t dqi_flags; /* Flags for quotafile (DQF_*) */ + u_int32_t dqi_blocks; /* Number of blocks in file */ + u_int32_t dqi_free_blk; /* Number of first free block in the list */ + u_int32_t dqi_free_entry; /* Number of block with at least one free entry */ +} __attribute__ ((packed)); + +/* + * Structure of header of block with quota structures. It is padded to 16 bytes so + * there will be space for exactly 18 quota-entries in a block + */ +struct v2_disk_dqdbheader { + u_int32_t dqdh_next_free; /* Number of next block with free entry */ + u_int32_t dqdh_prev_free; /* Number of previous block with free entry */ + u_int16_t dqdh_entries; /* Number of valid entries in block */ + u_int16_t dqdh_pad1; + u_int32_t dqdh_pad2; +} __attribute__ ((packed)); + +/* Structure of quota for one user on disk */ +struct v2_disk_dqblk { + u_int32_t dqb_id; /* id this quota applies to */ + u_int32_t dqb_ihardlimit; /* absolute limit on allocated inodes */ + u_int32_t dqb_isoftlimit; /* preferred inode limit */ + u_int32_t dqb_curinodes; /* current # allocated inodes */ + u_int32_t dqb_bhardlimit; /* absolute limit on disk space (in QUOTABLOCK_SIZE) */ + u_int32_t dqb_bsoftlimit; /* preferred limit on disk space (in QUOTABLOCK_SIZE) */ + u_int64_t dqb_curspace; /* current space occupied (in bytes) */ + u_int64_t dqb_btime; /* time limit for excessive disk use */ + u_int64_t dqb_itime; /* time limit for excessive inode use */ +} __attribute__ ((packed)); + +/* Structure of quota for communication with kernel */ +struct v2_kern_dqblk { + unsigned int dqb_ihardlimit; + unsigned int dqb_isoftlimit; + unsigned int dqb_curinodes; + unsigned int dqb_bhardlimit; + unsigned int dqb_bsoftlimit; + qsize_t dqb_curspace; + time_t dqb_btime; + time_t dqb_itime; +}; + +/* Structure of quotafile info for communication with kernel */ +struct v2_kern_dqinfo { + unsigned int dqi_bgrace; + unsigned int dqi_igrace; + unsigned int dqi_flags; + unsigned int dqi_blocks; + unsigned int dqi_free_blk; + unsigned int dqi_free_entry; +}; + +/* Structure with gathered statistics from kernel */ +struct v2_dqstats { + u_int32_t lookups; + u_int32_t drops; + u_int32_t reads; + u_int32_t writes; + u_int32_t cache_hits; + u_int32_t allocated_dquots; + u_int32_t free_dquots; + u_int32_t syncs; + u_int32_t version; +}; + +#ifndef Q_V2_GETQUOTA +#define Q_V2_GETQUOTA 0x0D00 +#endif + +#endif /* _QUOTAIO_LINUX_V2 */ + +#ifndef _QUOTAIO_LINUX_XFS +#define _QUOTAIO_LINUX_XFS + +/* + * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it would be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * Further, this software is distributed without any warranty that it is + * free of the rightful claim of any third person regarding infringement + * or the like. Any license provided herein, whether implied or + * otherwise, applies only to this software file. Patent licenses, if + * any, provided herein do not apply to combinations of this program with + * other software, or any other product whatsoever. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write the Free Software Foundation, Inc., 59 + * Temple Place - Suite 330, Boston MA 02111-1307, USA. + * + * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, + * Mountain View, CA 94043, or: + * + * http://www.sgi.com + * + * For further information regarding this notice, see: + * + * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ + */ + +#include <linux/types.h> + +#define XQM_CMD(cmd) ( ('X'<<8)+(cmd) ) +#define IS_XQM_CMD(cmd) ( ((int)(cmd)>>8) == 'X' ) + +/* + * Disk quota - quotactl(2) commands for XFS Quota Manager (XQM). + */ +#define Q_XQUOTAON XQM_CMD(0x1) /* enable quota accounting/enforcement */ +#define Q_XQUOTAOFF XQM_CMD(0x2) /* disable quota accounting/enforcement */ +#define Q_XGETQUOTA XQM_CMD(0x3) /* get disk limits & usage */ +#define Q_XSETQLIM XQM_CMD(0x4) /* set disk limits only */ +#define Q_XGETQSTAT XQM_CMD(0x5) /* returns fs_quota_stat_t struct */ +#define Q_XQUOTARM XQM_CMD(0x6) /* free quota files' space */ + +/* + * fs_disk_quota structure: + * + * This contains the current quota information regarding a user/proj/group. + * It is 64-bit aligned, and all the blk units are in BBs (Basic Blocks) of + * 512 bytes. + */ +#define FS_DQUOT_VERSION 1 /* fs_disk_quota.d_version */ +typedef struct fs_disk_quota { + u_int8_t d_version; /* version of this structure */ + u_int8_t d_flags; /* XFS_{USER,PROJ,GROUP}_QUOTA */ + u_int16_t d_fieldmask; /* field specifier */ + u_int32_t d_id; /* user, project, or group ID */ + u_int64_t d_blk_hardlimit; /* absolute limit on disk blks */ + u_int64_t d_blk_softlimit; /* preferred limit on disk blks */ + u_int64_t d_ino_hardlimit; /* maximum # allocated inodes */ + u_int64_t d_ino_softlimit; /* preferred inode limit */ + u_int64_t d_bcount; /* # disk blocks owned by the user */ + u_int64_t d_icount; /* # inodes owned by the user */ + int32_t d_itimer; /* zero if within inode limits */ + /* if not, we refuse service */ + int32_t d_btimer; /* similar to above; for disk blocks */ + u_int16_t d_iwarns; /* # warnings issued wrt num inodes */ + u_int16_t d_bwarns; /* # warnings issued wrt disk blocks */ + int32_t d_padding2; /* padding2 - for future use */ + u_int64_t d_rtb_hardlimit; /* absolute limit on realtime blks */ + u_int64_t d_rtb_softlimit; /* preferred limit on RT disk blks */ + u_int64_t d_rtbcount; /* # realtime blocks owned */ + int32_t d_rtbtimer; /* similar to above; for RT disk blks */ + u_int16_t d_rtbwarns; /* # warnings issued wrt RT disk blks */ + int16_t d_padding3; /* padding3 - for future use */ + char d_padding4[8]; /* yet more padding */ +} fs_disk_quota_t; + +/* + * These fields are sent to Q_XSETQLIM to specify fields that need to change. + */ +#define FS_DQ_ISOFT (1<<0) +#define FS_DQ_IHARD (1<<1) +#define FS_DQ_BSOFT (1<<2) +#define FS_DQ_BHARD (1<<3) +#define FS_DQ_RTBSOFT (1<<4) +#define FS_DQ_RTBHARD (1<<5) +#define FS_DQ_LIMIT_MASK (FS_DQ_ISOFT | FS_DQ_IHARD | FS_DQ_BSOFT | \ + FS_DQ_BHARD | FS_DQ_RTBSOFT | FS_DQ_RTBHARD) +/* + * These timers can only be set in super user's dquot. For others, timers are + * automatically started and stopped. Superusers timer values set the limits + * for the rest. In case these values are zero, the DQ_{F,B}TIMELIMIT values + * defined below are used. + * These values also apply only to the d_fieldmask field for Q_XSETQLIM. + */ +#define FS_DQ_BTIMER (1<<6) +#define FS_DQ_ITIMER (1<<7) +#define FS_DQ_RTBTIMER (1<<8) +#define FS_DQ_TIMER_MASK (FS_DQ_BTIMER | FS_DQ_ITIMER | FS_DQ_RTBTIMER) + +/* + * The following constants define the default amount of time given a user + * before the soft limits are treated as hard limits (usually resulting + * in an allocation failure). These may be modified by the quotactl(2) + * system call with the Q_XSETQLIM command. + */ +#define DQ_FTIMELIMIT (7 * 24*60*60) /* 1 week */ +#define DQ_BTIMELIMIT (7 * 24*60*60) /* 1 week */ + +/* + * Various flags related to quotactl(2). Only relevant to XFS filesystems. + */ +#define XFS_QUOTA_UDQ_ACCT (1<<0) /* user quota accounting */ +#define XFS_QUOTA_UDQ_ENFD (1<<1) /* user quota limits enforcement */ +#define XFS_QUOTA_GDQ_ACCT (1<<2) /* group quota accounting */ +#define XFS_QUOTA_GDQ_ENFD (1<<3) /* group quota limits enforcement */ + +#define XFS_USER_QUOTA (1<<0) /* user quota type */ +#define XFS_PROJ_QUOTA (1<<1) /* (IRIX) project quota type */ +#define XFS_GROUP_QUOTA (1<<2) /* group quota type */ + +/* + * fs_quota_stat is the struct returned in Q_XGETQSTAT for a given file system. + * Provides a centralized way to get meta infomation about the quota subsystem. + * eg. space taken up for user and group quotas, number of dquots currently + * incore. + */ +#define FS_QSTAT_VERSION 1 /* fs_quota_stat.qs_version */ + +/* + * Some basic infomation about 'quota files'. + */ +typedef struct fs_qfilestat { + u_int64_t qfs_ino; /* inode number */ + u_int64_t qfs_nblks; /* number of BBs 512-byte-blks */ + u_int32_t qfs_nextents; /* number of extents */ +} fs_qfilestat_t; + +typedef struct fs_quota_stat { + u_int8_t qs_version; /* version number for future changes */ + u_int16_t qs_flags; /* XFS_QUOTA_{U,P,G}DQ_{ACCT,ENFD} */ + u_int8_t qs_pad; /* unused */ + fs_qfilestat_t qs_uquota; /* user quota storage information */ + fs_qfilestat_t qs_gquota; /* group quota storage information */ + u_int32_t qs_incoredqs; /* number of dquots incore */ + int32_t qs_btimelimit; /* limit for blks timer */ + int32_t qs_itimelimit; /* limit for inodes timer */ + int32_t qs_rtbtimelimit; /* limit for rt blks timer */ + u_int16_t qs_bwarnlimit; /* limit for num warnings */ + u_int16_t qs_iwarnlimit; /* limit for num warnings */ +} fs_quota_stat_t; + +#endif /* _QUOTAIO_LINUX_XFS */ + +#ifndef QUOTABLOCK_SIZE +#define QUOTABLOCK_SIZE 1024 +#endif + +#endif /* _SAMBA_LINUX_QUOTA_H_ */ diff --git a/source/include/smb.h b/source/include/smb.h index 2b4d4fa690e..ed5230a8d69 100644 --- a/source/include/smb.h +++ b/source/include/smb.h @@ -199,6 +199,15 @@ typedef struct nttime_info } NTTIME; +#ifndef TIME_T_MIN +#define TIME_T_MIN ((time_t)0 < (time_t) -1 ? (time_t) 0 \ + : ~ (time_t) 0 << (sizeof (time_t) * CHAR_BIT - 1)) +#endif +#ifndef TIME_T_MAX +#define TIME_T_MAX (~ (time_t) 0 - TIME_T_MIN) +#endif + + /* the following rather strange looking definitions of NTSTATUS and WERROR and there in order to catch common coding errors where different error types are mixed up. This is especially important as we slowly convert Samba @@ -649,13 +658,14 @@ typedef struct sam_passwd * Flags for local user manipulation. */ -#define LOCAL_ADD_USER 0x1 -#define LOCAL_DELETE_USER 0x2 -#define LOCAL_DISABLE_USER 0x4 -#define LOCAL_ENABLE_USER 0x8 -#define LOCAL_TRUST_ACCOUNT 0x10 -#define LOCAL_SET_NO_PASSWORD 0x20 +#define LOCAL_ADD_USER 0x01 +#define LOCAL_DELETE_USER 0x02 +#define LOCAL_DISABLE_USER 0x04 +#define LOCAL_ENABLE_USER 0x08 +#define LOCAL_TRUST_ACCOUNT 0x10 +#define LOCAL_SET_NO_PASSWORD 0x20 #define LOCAL_SET_LDAP_ADMIN_PW 0x40 +#define LOCAL_GET_DOM_SID 0x80 /* key and data in the connections database - used in smbstatus and smbd */ struct connections_key { diff --git a/source/include/trans2.h b/source/include/trans2.h index 2e086510e6e..6b381d6c2ce 100644 --- a/source/include/trans2.h +++ b/source/include/trans2.h @@ -337,6 +337,13 @@ Byte offset Type name description #define SMB_UID_NO_CHANGE 0xFFFFFFFF #define SMB_GID_NO_CHANGE 0xFFFFFFFF +#define SMB_SIZE_NO_CHANGE_LO 0xFFFFFFFF +#define SMB_SIZE_NO_CHANGE_HI 0xFFFFFFFF + +#define SMB_TIME_NO_CHANGE_LO 0xFFFFFFFF +#define SMB_TIME_NO_CHANGE_HI 0xFFFFFFFF + + /* Offset Size Name 0 LARGE_INTEGER EndOfFile File size diff --git a/source/include/version.h b/source/include/version.h index d97a9a60b13..192beaa286e 100644 --- a/source/include/version.h +++ b/source/include/version.h @@ -1 +1 @@ -#define VERSION "2.2.4" +#define VERSION "2.2.5-pre1" |