~ubuntu-branches/ubuntu/vivid/samba/vivid

« back to all changes in this revision

Viewing changes to source3/include/includes.h

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2011-12-21 13:18:04 UTC
  • mfrom: (0.39.21 sid)
  • Revision ID: package-import@ubuntu.com-20111221131804-xtlr39wx6njehxxr
Tags: 2:3.6.1-3ubuntu1
* Merge from Debian testing.  Remaining changes:
  + debian/patches/VERSION.patch:
    - set SAMBA_VERSION_SUFFIX to Ubuntu.
  + debian/patches/error-trans.fix-276472:
    - Add the translation of Unix Error code -ENOTSUP to NT Error Code
    - NT_STATUS_NOT_SUPPORTED to prevent the Permission denied error.
  + debian/smb.conf:
    - add "(Samba, Ubuntu)" to server string.
    - comment out the default [homes] share, and add a comment about
      "valid users = %S" to show users how to restrict access to
      \\server\username to only username.
    - Set 'usershare allow guests', so that usershare admins are 
      allowed to create public shares in addition to authenticated
      ones.
    - add map to guest = Bad user, maps bad username to guest access.
  + debian/samba-common.config:
    - Do not change priority to high if dhclient3 is installed.
    - Use priority medium instead of high for the workgroup question.
  + debian/control:
    - Don't build against or suggest ctdb.
    - Add dependency on samba-common-bin to samba.
  + Add ufw integration:
    - Created debian/samba.ufw.profile
    - debian/rules, debian/samba.dirs, debian/samba.files: install
      profile
    - debian/control: have samba suggest ufw
  + Add apport hook:
    - Created debian/source_samba.py.
    - debian/rules, debian/samba.dirs, debian/samba-common-bin.files: install
  + Switch to upstart:
    - Add debian/samba.{nmbd,smbd}.upstart.
  + debian/samba.logrotate, debian/samba-common.dhcp, debian/samba.if-up:
    - Make them upstart compatible
  + debian/samba.postinst: 
    - Avoid scary pdbedit warnings on first import.
  + debian/samba-common.postinst: Add more informative error message for
    the case where smb.conf was manually deleted
  + debian/patches/fix-debuglevel-name-conflict.patch: don't use 'debug_level'
    as a global variable name in an NSS module 
  + Dropped:
    - debian/patches/error-trans.fix-276472
    - debian/patches/fix-debuglevel-name-conflict.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
#include "../replace/replace.h"
24
24
 
 
25
#if _SAMBA_BUILD_ == 4
 
26
# undef _SAMBA_BUILD_
 
27
# define _SAMBA_BUILD_ 3
 
28
#endif
 
29
 
25
30
/* make sure we have included the correct config.h */
26
31
#ifndef NO_CONFIG_H /* for some tests */
27
32
#ifndef CONFIG_H_IS_FROM_SAMBA
34
39
   to include --with-developer since too many systems
35
40
   still have comflicts with their header files (e.g. IRIX 6.4) */
36
41
 
37
 
#if !defined(__cplusplus) && defined(DEVELOPER)
 
42
#if !defined(__cplusplus) && defined(DEVELOPER) && defined(__linux__)
38
43
#define class #error DONT_USE_CPLUSPLUS_RESERVED_NAMES
39
44
#define private #error DONT_USE_CPLUSPLUS_RESERVED_NAMES
40
45
#define public #error DONT_USE_CPLUSPLUS_RESERVED_NAMES
48
53
 
49
54
#include "local.h"
50
55
 
51
 
#ifdef AIX
52
 
#define DEFAULT_PRINTING PRINT_AIX
53
 
#define PRINTCAP_NAME "/etc/qconfig"
54
 
#endif
55
 
 
56
 
#ifdef HPUX
57
 
#define DEFAULT_PRINTING PRINT_HPUX
58
 
#endif
59
 
 
60
 
#ifdef QNX
61
 
#define DEFAULT_PRINTING PRINT_QNX
62
 
#endif
63
 
 
64
56
#ifdef SUNOS4
65
57
/* on SUNOS4 termios.h conflicts with sys/ioctl.h */
66
58
#undef HAVE_TERMIOS_H
76
68
#endif
77
69
#endif /* RELIANTUNIX */
78
70
 
79
 
#include "system/capability.h"
80
71
#include "system/dir.h"
81
 
#include "system/filesys.h"
82
 
#include "system/glob.h"
83
 
#include "system/iconv.h"
84
72
#include "system/locale.h"
85
 
#include "system/network.h"
86
 
#include "system/passwd.h"
87
 
#include "system/readline.h"
88
 
#include "system/select.h"
89
 
#include "system/shmem.h"
90
 
#include "system/syslog.h"
91
 
#include "system/terminal.h"
92
73
#include "system/time.h"
93
74
#include "system/wait.h"
94
75
 
145
126
#undef HAVE_KRB5
146
127
#endif
147
128
 
148
 
#if HAVE_LBER_H
149
 
#include <lber.h>
150
 
#if defined(HPUX) && !defined(_LBER_TYPES_H)
151
 
/* Define ber_tag_t and ber_int_t for using
152
 
 * HP LDAP-UX Integration products' LDAP libraries.
153
 
*/
154
 
#ifndef ber_tag_t
155
 
typedef unsigned long ber_tag_t;
156
 
typedef int ber_int_t;
157
 
#endif
158
 
#endif /* defined(HPUX) && !defined(_LBER_TYPES_H) */
159
 
#ifndef LBER_USE_DER
160
 
#define LBER_USE_DER 0x01
161
 
#endif
162
 
#endif
163
 
 
164
 
#if HAVE_LDAP_H
165
 
#include <ldap.h>
166
 
#ifndef LDAP_CONST
167
 
#define LDAP_CONST const
168
 
#endif
169
 
#ifndef LDAP_OPT_SUCCESS
170
 
#define LDAP_OPT_SUCCESS 0
171
 
#endif
172
 
/* Solaris 8 and maybe other LDAP implementations spell this "..._INPROGRESS": */
173
 
#if defined(LDAP_SASL_BIND_INPROGRESS) && !defined(LDAP_SASL_BIND_IN_PROGRESS)
174
 
#define LDAP_SASL_BIND_IN_PROGRESS LDAP_SASL_BIND_INPROGRESS
175
 
#endif
176
 
/* Solaris 8 defines SSL_LDAP_PORT, not LDAPS_PORT and it only does so if
177
 
   LDAP_SSL is defined - but SSL is not working. We just want the
178
 
   port number! Let's just define LDAPS_PORT correct. */
179
 
#if !defined(LDAPS_PORT)
180
 
#define LDAPS_PORT 636
181
 
#endif
182
 
#else
 
129
#ifndef HAVE_LDAP_H
183
130
#undef HAVE_LDAP
184
131
#endif
185
132
 
186
 
#if HAVE_GSSAPI_GSSAPI_H
187
 
#include <gssapi/gssapi.h>
188
 
#elif HAVE_GSSAPI_GSSAPI_GENERIC_H
189
 
#include <gssapi/gssapi_generic.h>
190
 
#elif HAVE_GSSAPI_H
191
 
#include <gssapi.h>
192
 
#endif
193
 
 
194
 
#if HAVE_COM_ERR_H
195
 
#include <com_err.h>
196
 
#endif
197
 
 
198
133
#if HAVE_SYS_ATTRIBUTES_H
199
134
#include <sys/attributes.h>
200
135
#endif
238
173
#include <aio.h>
239
174
#endif
240
175
 
241
 
#ifdef WITH_MADVISE_PROTECTED
242
 
#include <sys/mman.h>
243
 
#endif
244
 
 
245
176
/* Special macros that are no-ops except when run under Valgrind on
246
177
 * x86.  They've moved a little bit from valgrind 1.0.4 to 1.9.4 */
247
178
#if HAVE_VALGRIND_MEMCHECK_H
251
182
#include <valgrind.h>
252
183
#endif
253
184
 
254
 
/* If we have --enable-developer and the valgrind header is present,
255
 
 * then we're OK to use it.  Set a macro so this logic can be done only
256
 
 * once. */
257
 
#if defined(DEVELOPER)
258
 
#if (HAVE_VALGRIND_H || HAVE_VALGRIND_VALGRIND_H)
259
 
#define VALGRIND
260
 
#endif
261
 
#endif
262
 
 
263
 
 
264
185
/* we support ADS if we want it and have krb5 and ldap libs */
265
186
#if defined(WITH_ADS) && defined(HAVE_KRB5) && defined(HAVE_LDAP)
266
187
#define HAVE_ADS
383
304
#endif
384
305
 
385
306
#ifdef LARGE_SMB_INO_T
386
 
#define SINO_T_VAL(p, ofs, v) (SIVAL((p),(ofs),(v)&0xFFFFFFFF), SIVAL((p),(ofs)+4,(v)>>32))
387
 
#define INO_T_VAL(p, ofs) ((SMB_INO_T)(((uint64_t)(IVAL(p,ofs)))| (((uint64_t)(IVAL(p,(ofs)+4))) << 32)))
 
307
#define SINO_T_VAL(p, ofs, v) SBVAL(p, ofs, v)
 
308
#define INO_T_VAL(p, ofs) ((SMB_INO_T)BVAL(p, ofs))
388
309
#else 
389
 
#define SINO_T_VAL(p, ofs, v) (SIVAL(p,ofs,v),SIVAL(p,(ofs)+4,0))
 
310
#define SINO_T_VAL(p, ofs, v) SBVAL(p, ofs, ((uint64_t)(v)) & UINT32_MAX)
390
311
#define INO_T_VAL(p, ofs) ((SMB_INO_T)(IVAL((p),(ofs))))
391
312
#endif
392
313
 
398
319
#  endif
399
320
#endif
400
321
 
401
 
#define SBIG_UINT(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), SIVAL(p,(ofs)+4,(v)>>32))
402
 
#define BIG_UINT(p, ofs) ((((uint64_t) IVAL(p,(ofs)+4))<<32)|IVAL(p,ofs))
403
 
#define IVAL2_TO_SMB_BIG_UINT(buf,off) ( (((uint64_t)(IVAL((buf),(off)))) & ((uint64_t)0xFFFFFFFF)) | \
404
 
                (( ((uint64_t)(IVAL((buf),(off+4)))) & ((uint64_t)0xFFFFFFFF) ) << 32 ) )
405
 
 
 
322
/* TODO: remove this macros */
 
323
#define SBIG_UINT(p, ofs, v) SBVAL(p, ofs, v)
 
324
#define BIG_UINT(p, ofs) BVAL(p, ofs)
 
325
#define IVAL2_TO_SMB_BIG_UINT(p, ofs) BVAL(p, ofs)
406
326
 
407
327
/* this should really be a 64 bit type if possible */
408
328
typedef uint64_t br_off;
552
472
#  endif
553
473
#endif
554
474
 
555
 
#ifndef HAVE_STRUCT_TIMESPEC
556
 
struct timespec {
557
 
        time_t tv_sec;            /* Seconds.  */
558
 
        long tv_nsec;           /* Nanoseconds.  */
559
 
};
560
 
#endif
561
 
 
562
475
enum timestamp_set_resolution {
563
476
        TIMESTAMP_SET_SECONDS = 0,
564
477
        TIMESTAMP_SET_MSEC,
565
478
        TIMESTAMP_SET_NT_OR_BETTER
566
479
};
567
480
 
568
 
#ifdef HAVE_BROKEN_GETGROUPS
569
 
#define GID_T int
570
 
#else
571
 
#define GID_T gid_t
572
 
#endif
573
 
 
574
 
#ifndef NGROUPS_MAX
575
 
#define NGROUPS_MAX 32 /* Guess... */
576
 
#endif
577
 
 
578
481
/* Our own fstrings */
579
482
 
580
483
/*
599
502
typedef char fstring[FSTRING_LEN];
600
503
#endif
601
504
 
602
 
/* Samba 3 doesn't use iconv_convenience: */
603
 
extern void *cmdline_lp_ctx;
604
 
struct smb_iconv_convenience *lp_iconv_convenience(void *lp_ctx);
605
 
 
606
505
/* Lists, trees, caching, database... */
607
506
#include "../lib/util/util.h"
608
507
#include "../lib/util/util_net.h"
609
508
#include "../lib/util/xfile.h"
610
509
#include "../lib/util/memory.h"
611
510
#include "../lib/util/attr.h"
612
 
#include "intl.h"
 
511
#include "../lib/util/tsort.h"
613
512
#include "../lib/util/dlinklist.h"
614
 
#include "tdb.h"
615
 
#include "util_tdb.h"
616
513
 
617
 
#include "talloc.h"
 
514
#include <talloc.h>
618
515
 
619
516
#include "event.h"
620
 
#include "../lib/util/tevent_unix.h"
621
 
#include "../lib/util/tevent_ntstatus.h"
622
 
#include "../lib/tsocket/tsocket.h"
623
517
 
624
518
#include "../lib/util/data_blob.h"
625
519
#include "../lib/util/time.h"
626
 
#include "../lib/util/asn1.h"
 
520
#include "../lib/util/debug.h"
 
521
#include "../lib/util/debug_s3.h"
627
522
 
628
 
#include "ads.h"
629
 
#include "ads_dns.h"
630
 
#include "interfaces.h"
631
 
#include "trans2.h"
 
523
#include "../libcli/util/ntstatus.h"
632
524
#include "../libcli/util/error.h"
633
 
#include "ntioctl.h"
634
525
#include "../lib/util/charset/charset.h"
635
526
#include "dynconfig.h"
636
 
#include "util_getent.h"
637
 
#include "debugparse.h"
638
 
#include "privileges.h"
639
 
#include "messages.h"
640
527
#include "locking.h"
641
528
#include "smb_perfcount.h"
642
 
#include "smb_signing.h"
643
529
#include "smb.h"
644
 
#include "nameserv.h"
645
 
#include "secrets.h"
646
530
#include "../lib/util/byteorder.h"
647
 
#include "privileges.h"
648
 
#include "rpc_misc.h"
649
 
#include "rpc_dce.h"
650
 
#include "../librpc/gen_ndr/schannel.h"
651
 
#include "mapping.h"
652
 
#include "passdb.h"
653
 
#include "rpc_secdes.h"
654
 
#include "../libgpo/gpo.h"
655
 
#include "msdfs.h"
656
 
#include "rap.h"
657
 
#include "../lib/crypto/md5.h"
658
 
#include "../lib/crypto/md4.h"
659
 
#include "../lib/crypto/arcfour.h"
660
 
#include "../lib/crypto/crc32.h"
661
 
#include "../lib/crypto/hmacmd5.h"
662
 
#include "ntlmssp.h"
663
 
#include "auth.h"
664
 
#include "ntdomain.h"
665
 
#include "reg_objects.h"
666
 
#include "reg_db.h"
667
 
#include "librpc/gen_ndr/perfcount.h"
668
 
#include "librpc/gen_ndr/notify.h"
669
 
#include "librpc/gen_ndr/xattr.h"
670
 
#include "librpc/gen_ndr/messaging.h"
671
 
#include "librpc/gen_ndr/ndr_nbt.h"
672
 
#include "librpc/rpc/dcerpc.h"
673
 
#include "nt_printing.h"
674
 
#include "idmap.h"
675
 
#include "client.h"
676
531
 
677
 
#include "session.h"
678
 
#include "popt.h"
679
 
#include "mangle.h"
680
532
#include "module.h"
681
 
#include "nsswitch/winbind_client.h"
682
 
#include "dbwrap.h"
683
 
#include "packet.h"
684
 
#include "ctdbd_conn.h"
685
533
#include "../lib/util/talloc_stack.h"
686
 
#include "memcache.h"
687
 
#include "async_smb.h"
688
 
#include "../lib/async_req/async_sock.h"
689
 
#include "talloc_dict.h"
690
 
#include "services.h"
691
 
#include "eventlog.h"
692
534
#include "../lib/util/smb_threads.h"
693
535
#include "../lib/util/smb_threads_internal.h"
694
 
#include "tldap.h"
695
 
#include "tldap_util.h"
696
 
 
697
 
#include "lib/smbconf/smbconf.h"
698
 
#include "lib/smbconf/smbconf_init.h"
699
 
#include "lib/smbconf/smbconf_reg.h"
700
 
#include "lib/smbconf/smbconf_txt.h"
701
 
 
702
 
/* Defines for wisXXX functions. */
703
 
#define UNI_UPPER    0x1
704
 
#define UNI_LOWER    0x2
705
 
#define UNI_DIGIT    0x4
706
 
#define UNI_XDIGIT   0x8
707
 
#define UNI_SPACE    0x10
708
 
 
709
 
#include "nsswitch/winbind_nss.h"
710
 
 
711
 
/* forward declaration from printing.h to get around 
712
 
   header file dependencies */
713
 
 
714
 
struct printjob;
715
 
 
716
 
/* forward declarations from smbldap.c */
717
 
 
718
 
#include "smbldap.h"
719
 
 
720
 
/*
721
 
 * Reasons for cache flush.
722
 
 */
723
 
 
724
 
enum flush_reason_enum {
725
 
    SEEK_FLUSH,
726
 
    READ_FLUSH,
727
 
    WRITE_FLUSH,
728
 
    READRAW_FLUSH,
729
 
    OPLOCK_RELEASE_FLUSH,
730
 
    CLOSE_FLUSH,
731
 
    SYNC_FLUSH,
732
 
    SIZECHANGE_FLUSH,
733
 
    /* NUM_FLUSH_REASONS must remain the last value in the enumeration. */
734
 
    NUM_FLUSH_REASONS};
735
 
 
736
 
#include "nss_info.h"
737
 
#include "modules/nfs4_acls.h"
738
 
#include "nsswitch/libwbclient/wbclient.h"
739
536
 
740
537
/***** prototypes *****/
741
538
#ifndef NO_PROTO_H
742
539
#include "proto.h"
743
540
#endif
744
 
#include "libcli/security/secace.h"
745
 
#include "libcli/security/secacl.h"
746
 
#include "libcli/security/security_descriptor.h"
747
 
 
748
 
#if defined(HAVE_POSIX_ACLS)
749
 
#include "modules/vfs_posixacl.h"
750
 
#endif
751
 
 
752
 
#if defined(HAVE_TRU64_ACLS)
753
 
#include "modules/vfs_tru64acl.h"
754
 
#endif
755
 
 
756
 
#if defined(HAVE_SOLARIS_ACLS) || defined(HAVE_UNIXWARE_ACLS)
757
 
#include "modules/vfs_solarisacl.h"
758
 
#endif
759
 
 
760
 
#if defined(HAVE_HPUX_ACLS)
761
 
#include "modules/vfs_hpuxacl.h"
762
 
#endif
763
 
 
764
 
#if defined(HAVE_IRIX_ACLS)
765
 
#include "modules/vfs_irixacl.h"
766
 
#endif
767
 
 
768
 
#ifdef HAVE_LDAP
769
 
#include "ads_protos.h"
770
 
#endif
771
 
 
772
 
/* We need this after proto.h to reference GetTimeOfDay(). */
773
 
#include "smbprofile.h"
774
541
 
775
542
/* String routines */
776
543
 
777
544
#include "srvstr.h"
778
545
#include "safe_string.h"
779
546
 
780
 
/* prototypes from lib/util_transfer_file.c */
781
 
#include "transfer_file.h"
782
 
 
783
 
#ifndef DEFAULT_PRINTING
784
 
#ifdef HAVE_CUPS
785
 
#define DEFAULT_PRINTING PRINT_CUPS
786
 
#define PRINTCAP_NAME "cups"
787
 
#elif defined(SYSV)
788
 
#define DEFAULT_PRINTING PRINT_SYSV
789
 
#define PRINTCAP_NAME "lpstat"
790
 
#else
791
 
#define DEFAULT_PRINTING PRINT_BSD
792
 
#define PRINTCAP_NAME "/etc/printcap"
793
 
#endif
794
 
#endif
795
 
 
796
 
#ifndef PRINTCAP_NAME
797
 
#define PRINTCAP_NAME "/etc/printcap"
798
 
#endif
799
 
 
800
547
#ifndef SIGCLD
801
548
#define SIGCLD SIGCHLD
802
549
#endif
805
552
#define SIGRTMIN NSIG
806
553
#endif
807
554
 
808
 
#ifndef MAP_FILE
809
 
#define MAP_FILE 0
810
 
#endif
811
 
 
812
555
#if defined(HAVE_PUTPRPWNAM) && defined(AUTH_CLEARTEXT_SEG_CHARS)
813
556
#define OSF1_ENH_SEC 1
814
557
#endif
815
558
 
816
 
#ifndef ALLOW_CHANGE_PASSWORD
817
 
#if (defined(HAVE_TERMIOS_H) && defined(HAVE_DUP2) && defined(HAVE_SETSID))
818
 
#define ALLOW_CHANGE_PASSWORD 1
819
 
#endif
820
 
#endif
821
 
 
822
 
/* what is the longest significant password available on your system? 
823
 
 Knowing this speeds up password searches a lot */
824
 
#ifndef PASSWORD_LENGTH
825
 
#define PASSWORD_LENGTH 8
826
 
#endif
827
 
 
828
 
#ifndef HAVE_PIPE
829
 
#define SYNC_DNS 1
830
 
#endif
831
 
 
832
559
#if defined(HAVE_CRYPT16) && defined(HAVE_GETAUTHUID)
833
560
#define ULTRIX_AUTH 1
834
561
#endif
851
578
#endif
852
579
 
853
580
 
854
 
#if HAVE_KERNEL_SHARE_MODES
855
 
#ifndef LOCK_MAND 
856
 
#define LOCK_MAND       32      /* This is a mandatory flock */
857
 
#define LOCK_READ       64      /* ... Which allows concurrent read operations */
858
 
#define LOCK_WRITE      128     /* ... Which allows concurrent write operations */
859
 
#define LOCK_RW         192     /* ... Which allows concurrent read & write ops */
860
 
#endif
861
 
#endif
862
 
 
863
 
extern int DEBUGLEVEL;
864
 
 
865
581
#define MAX_SEC_CTX_DEPTH 8    /* Maximum number of security contexts */
866
582
 
867
583
 
878
594
#endif
879
595
 
880
596
 
881
 
/* needed for some systems without iconv. Doesn't really matter
882
 
   what error code we use */
883
 
#ifndef EILSEQ
884
 
#define EILSEQ EIO
885
 
#endif
886
 
 
887
597
/* add varargs prototypes with printf checking */
888
598
/*PRINTFLIKE2 */
889
599
int fdprintf(int , const char *, ...) PRINTF_ATTRIBUTE(2,3);
921
631
#define XATTR_REPLACE 0x2       /* set value, fail if attr does not exist */
922
632
#endif
923
633
 
924
 
#ifdef HAVE_LDAP
925
 
 
926
 
/* function declarations not included in proto.h */
927
 
LDAP *ldap_open_with_timeout(const char *server, int port, unsigned int to);
928
 
 
929
 
#endif  /* HAVE_LDAP */
930
 
 
931
 
#if defined(HAVE_LINUX_READAHEAD) && ! defined(HAVE_READAHEAD_DECL)
932
 
ssize_t readahead(int fd, off64_t offset, size_t count);
933
 
#endif
934
 
 
935
634
#ifdef TRUE
936
635
#undef TRUE
937
636
#endif
959
658
void exit_server_cleanly(const char *const reason) _NORETURN_;
960
659
void exit_server_fault(void) _NORETURN_;
961
660
 
962
 
#ifdef HAVE_LIBNSCD
963
 
#include "libnscd.h"
964
 
#endif
965
 
 
966
 
#if defined(HAVE_IPV6)
967
 
void in6_addr_to_sockaddr_storage(struct sockaddr_storage *ss,
968
 
                                  struct in6_addr ip);
969
 
#endif
970
 
 
971
661
/* samba3 doesn't use uwrap yet */
972
662
#define uwrap_enabled() 0
973
663
 
 
664
#define BASE_RID (0x000003E8L)
 
665
 
974
666
#endif /* _INCLUDES_H */