From 6f214cc510a59b7a65ee9d4486baf14a3e579f73 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 3 Nov 2004 00:17:12 +0000 Subject: r3494: got rid of include/rewrite.h, and split out the dynconfig.h header (This used to be commit 558de54ec6432a4ae90aa14a585f32c6cd03ced2) --- source4/client/client.c | 1 + source4/gtk/tools/gepdump.c | 7 ++- source4/gtk/tools/gregedit.c | 1 + source4/gtk/tools/gwcrontab.c | 1 + source4/gtk/tools/gwsam.c | 1 + source4/include/charset.h | 13 ++++ source4/include/includes.h | 17 ++++-- source4/include/pstring.h | 8 +-- source4/include/rewrite.h | 91 --------------------------- source4/include/smb.h | 12 ++++ source4/ldap_server/ldap_rootdse.c | 1 + source4/lib/cmdline/popt_common.c | 1 + source4/lib/debug.c | 1 + source4/lib/registry/tools/regdiff.c | 1 + source4/lib/registry/tools/regpatch.c | 1 + source4/lib/registry/tools/regshell.c | 1 + source4/lib/registry/tools/regtree.c | 1 + source4/lib/substitute.c | 1 + source4/lib/util.c | 1 + source4/libcli/namequery.c | 112 ---------------------------------- source4/nsswitch/winbind_nss_config.h | 3 +- source4/param/loadparm.c | 1 + source4/smbd/rewrite.c | 1 + source4/torture/gentest.c | 1 + source4/torture/locktest.c | 1 + source4/torture/masktest.c | 1 + source4/torture/torture.c | 1 + source4/utils/net/net.c | 1 + source4/utils/ntlm_auth.c | 1 + 29 files changed, 66 insertions(+), 218 deletions(-) delete mode 100644 source4/include/rewrite.h (limited to 'source4') diff --git a/source4/client/client.c b/source4/client/client.c index 9c9b623920..82377e82a9 100644 --- a/source4/client/client.c +++ b/source4/client/client.c @@ -22,6 +22,7 @@ */ #include "includes.h" +#include "dynconfig.h" #include "client.h" #include "lib/cmdline/popt_common.h" #include "librpc/gen_ndr/ndr_srvsvc.h" diff --git a/source4/gtk/tools/gepdump.c b/source4/gtk/tools/gepdump.c index 52e6bdad7d..1ad84b99f5 100644 --- a/source4/gtk/tools/gepdump.c +++ b/source4/gtk/tools/gepdump.c @@ -20,6 +20,7 @@ */ #include "includes.h" +#include "dynconfig.h" #include "librpc/gen_ndr/ndr_epmapper.h" #include "gtk/common/select.h" #include "gtk/common/gtk-smb.h" @@ -322,9 +323,9 @@ static GtkWidget* create_mainwindow (void) int main(int argc, char **argv) { gtk_init(&argc, &argv); - lp_load(dyn_CONFIGFILE,True,False,False); - load_interfaces(); - setup_logging("gepdump", True); + lp_load(dyn_CONFIGFILE,True,False,False); + load_interfaces(); + setup_logging("gepdump", True); mainwin = create_mainwindow(); gtk_widget_show_all(mainwin); gtk_main(); diff --git a/source4/gtk/tools/gregedit.c b/source4/gtk/tools/gregedit.c index 10d9a127c4..f5c2fd5957 100644 --- a/source4/gtk/tools/gregedit.c +++ b/source4/gtk/tools/gregedit.c @@ -20,6 +20,7 @@ */ #include "includes.h" +#include "dynconfig.h" #include "registry.h" #include "lib/cmdline/popt_common.h" #include "gtk/common/select.h" diff --git a/source4/gtk/tools/gwcrontab.c b/source4/gtk/tools/gwcrontab.c index 38e4e11103..b1176a3fa8 100644 --- a/source4/gtk/tools/gwcrontab.c +++ b/source4/gtk/tools/gwcrontab.c @@ -20,6 +20,7 @@ */ #include "includes.h" +#include "dynconfig.h" #include "librpc/gen_ndr/ndr_atsvc.h" #include "gtk/common/select.h" #include "gtk/common/gtk-smb.h" diff --git a/source4/gtk/tools/gwsam.c b/source4/gtk/tools/gwsam.c index cf8e1d5b5f..18fd578f64 100644 --- a/source4/gtk/tools/gwsam.c +++ b/source4/gtk/tools/gwsam.c @@ -20,6 +20,7 @@ */ #include "includes.h" +#include "dynconfig.h" #include "librpc/gen_ndr/ndr_samr.h" #include "gtk/common/select.h" #include "gtk/common/gtk-smb.h" diff --git a/source4/include/charset.h b/source4/include/charset.h index 6c3ad2d916..ba1402acb3 100644 --- a/source4/include/charset.h +++ b/source4/include/charset.h @@ -42,3 +42,16 @@ struct charset_functions { typedef uint32_t codepoint_t; #define INVALID_CODEPOINT ((codepoint_t)-1) + + +/* generic iconv conversion structure */ +typedef struct { + size_t (*direct)(void *cd, const char **inbuf, size_t *inbytesleft, + char **outbuf, size_t *outbytesleft); + size_t (*pull)(void *cd, const char **inbuf, size_t *inbytesleft, + char **outbuf, size_t *outbytesleft); + size_t (*push)(void *cd, const char **inbuf, size_t *inbytesleft, + char **outbuf, size_t *outbytesleft); + void *cd_direct, *cd_pull, *cd_push; +} *smb_iconv_t; + diff --git a/source4/include/includes.h b/source4/include/includes.h index 78397faac6..9f2c233e73 100644 --- a/source4/include/includes.h +++ b/source4/include/includes.h @@ -127,6 +127,12 @@ #define uint64 uint64_t #endif +#define False (0) +#define True (1) +#define Auto (2) + +typedef int BOOL; + /* we use struct ipv4_addr to avoid having to include all the system networking headers everywhere @@ -152,11 +158,7 @@ extern char *sys_errlist[]; extern int errno; #endif -/* Our own pstrings and fstrings */ -#include "pstring.h" - /* Lists, trees, caching, database... */ -#include "dynconfig.h" #include "version.h" #include "xfile.h" #include "talloc.h" @@ -169,7 +171,12 @@ extern int errno; #include "trans2.h" #include "nterr.h" #include "charset.h" -#include "rewrite.h" +#include "debug.h" +#include "doserr.h" +#include "enums.h" +#include "pstring.h" +#include "smb_macros.h" +#include "rpc_secdes.h" #include "smb.h" #include "ads.h" #include "lib/socket/socket.h" diff --git a/source4/include/pstring.h b/source4/include/pstring.h index 92870e4cae..5bd03ec0d8 100644 --- a/source4/include/pstring.h +++ b/source4/include/pstring.h @@ -1,6 +1,8 @@ /* samba -- Unix SMB/CIFS implementation. - Safe standardized string types + + ugly string types from Samba3. Will be removed + with glee when we finally don't use them. Copyright (C) Andrew Tridgell 1992-2000 Copyright (C) John H Terpstra 1996-2000 @@ -23,8 +25,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef _PSTRING - #define PSTRING_LEN 1024 #define FSTRING_LEN 256 @@ -32,5 +32,3 @@ typedef char pstring[PSTRING_LEN]; typedef char fstring[FSTRING_LEN]; #define _PSTRING - -#endif /* ndef _PSTRING */ diff --git a/source4/include/rewrite.h b/source4/include/rewrite.h deleted file mode 100644 index fa2168bed7..0000000000 --- a/source4/include/rewrite.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - Unix SMB/CIFS implementation. - SMB parameters and setup, plus a whole lot more. - - Copyright (C) Andrew Tridgell 1992-2000 - Copyright (C) John H Terpstra 1996-2002 - Copyright (C) Luke Kenneth Casson Leighton 1996-2000 - Copyright (C) Paul Ashton 1998-2000 - Copyright (C) Simo Sorce 2001-2002 - Copyright (C) Martin Pool 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. -*/ - -#ifndef _REWRITE_H -#define _REWRITE_H - -#define False (0) -#define True (1) -#define Auto (2) - -#ifndef _BOOL -typedef int BOOL; -#define _BOOL /* So we don't typedef BOOL again in vfs.h */ -#endif - -/* string manipulation flags - see clistr.c and srvstr.c */ -#define STR_TERMINATE 1 -#define STR_UPPER 2 -#define STR_ASCII 4 -#define STR_UNICODE 8 -#define STR_NOALIGN 16 -#define STR_NO_RANGE_CHECK 32 -#define STR_LEN8BIT 64 -#define STR_TERMINATE_ASCII 128 /* only terminate if ascii */ -#define STR_LEN_NOTERM 256 /* the length field is the unterminated length */ - -/* Debugging stuff */ -#include "debug.h" -#include "doserr.h" - -#include "enums.h" - -/* - * Loopback command offsets. - */ - -#define OPBRK_CMD_LEN_OFFSET 0 -#define OPBRK_CMD_PORT_OFFSET 4 -#define OPBRK_CMD_HEADER_LEN 6 - -#define OPBRK_MESSAGE_CMD_OFFSET 0 - -/* Message types */ -#define OPLOCK_BREAK_CMD 0x1 -#define KERNEL_OPLOCK_BREAK_CMD 0x2 -#define LEVEL_II_OPLOCK_BREAK_CMD 0x3 -#define ASYNC_LEVEL_II_OPLOCK_BREAK_CMD 0x4 - -#define CMD_REPLY 0x8000 - -#include "smb_macros.h" - -#include "rpc_secdes.h" - -#define SAFE_NETBIOS_CHARS ". -_" - -/* generic iconv conversion structure */ -typedef struct { - size_t (*direct)(void *cd, const char **inbuf, size_t *inbytesleft, - char **outbuf, size_t *outbytesleft); - size_t (*pull)(void *cd, const char **inbuf, size_t *inbytesleft, - char **outbuf, size_t *outbytesleft); - size_t (*push)(void *cd, const char **inbuf, size_t *inbytesleft, - char **outbuf, size_t *outbytesleft); - void *cd_direct, *cd_pull, *cd_push; -} *smb_iconv_t; - -#endif /* _REWRITE_H */ diff --git a/source4/include/smb.h b/source4/include/smb.h index bc9eb2acb8..940af75671 100644 --- a/source4/include/smb.h +++ b/source4/include/smb.h @@ -592,4 +592,16 @@ typedef uint64_t HYPER_T; /* passed to br lock code */ enum brl_type {READ_LOCK, WRITE_LOCK, PENDING_READ_LOCK, PENDING_WRITE_LOCK}; +/* string manipulation flags - see clistr.c and srvstr.c */ +#define STR_TERMINATE 1 +#define STR_UPPER 2 +#define STR_ASCII 4 +#define STR_UNICODE 8 +#define STR_NOALIGN 16 +#define STR_NO_RANGE_CHECK 32 +#define STR_LEN8BIT 64 +#define STR_TERMINATE_ASCII 128 /* only terminate if ascii */ +#define STR_LEN_NOTERM 256 /* the length field is the unterminated length */ + + #endif /* _SMB_H */ diff --git a/source4/ldap_server/ldap_rootdse.c b/source4/ldap_server/ldap_rootdse.c index db8be05467..2b9efa11b4 100644 --- a/source4/ldap_server/ldap_rootdse.c +++ b/source4/ldap_server/ldap_rootdse.c @@ -19,6 +19,7 @@ */ #include "includes.h" +#include "dynconfig.h" #include "ldap_server/ldap_server.h" #include "system/time.h" diff --git a/source4/lib/cmdline/popt_common.c b/source4/lib/cmdline/popt_common.c index 7d4dead4de..6422b84b44 100644 --- a/source4/lib/cmdline/popt_common.c +++ b/source4/lib/cmdline/popt_common.c @@ -21,6 +21,7 @@ */ #include "includes.h" +#include "dynconfig.h" #include "system/passwd.h" #include "lib/cmdline/popt_common.h" diff --git a/source4/lib/debug.c b/source4/lib/debug.c index 4f6ba125d3..f1e9cec38e 100644 --- a/source4/lib/debug.c +++ b/source4/lib/debug.c @@ -20,6 +20,7 @@ */ #include "includes.h" +#include "dynconfig.h" /* this global variable determines what messages are printed */ int DEBUGLEVEL; diff --git a/source4/lib/registry/tools/regdiff.c b/source4/lib/registry/tools/regdiff.c index c1b8d2949e..80f4a5c49f 100644 --- a/source4/lib/registry/tools/regdiff.c +++ b/source4/lib/registry/tools/regdiff.c @@ -20,6 +20,7 @@ */ #include "includes.h" +#include "dynconfig.h" #include "registry.h" #include "lib/cmdline/popt_common.h" diff --git a/source4/lib/registry/tools/regpatch.c b/source4/lib/registry/tools/regpatch.c index ae4d331e3c..38eabb60a9 100644 --- a/source4/lib/registry/tools/regpatch.c +++ b/source4/lib/registry/tools/regpatch.c @@ -21,6 +21,7 @@ */ #include "includes.h" +#include "dynconfig.h" #include "registry.h" #include "lib/cmdline/popt_common.h" diff --git a/source4/lib/registry/tools/regshell.c b/source4/lib/registry/tools/regshell.c index 583624fbab..d705a0b802 100644 --- a/source4/lib/registry/tools/regshell.c +++ b/source4/lib/registry/tools/regshell.c @@ -20,6 +20,7 @@ */ #include "includes.h" +#include "dynconfig.h" #include "registry.h" #include "lib/cmdline/popt_common.h" #include "system/time.h" diff --git a/source4/lib/registry/tools/regtree.c b/source4/lib/registry/tools/regtree.c index 8fd73aef85..a8225c026d 100644 --- a/source4/lib/registry/tools/regtree.c +++ b/source4/lib/registry/tools/regtree.c @@ -20,6 +20,7 @@ */ #include "includes.h" +#include "dynconfig.h" #include "registry.h" #include "lib/cmdline/popt_common.h" diff --git a/source4/lib/substitute.c b/source4/lib/substitute.c index a01b90450a..a351db1af2 100644 --- a/source4/lib/substitute.c +++ b/source4/lib/substitute.c @@ -37,6 +37,7 @@ void sub_set_context(struct substitute_context *subptr) */ static void setup_string(char **dest, const char *str) { +#define SAFE_NETBIOS_CHARS ". -_" char *s; s = strdup(str); diff --git a/source4/lib/util.c b/source4/lib/util.c index 5385174ce4..d8e9cb50f9 100644 --- a/source4/lib/util.c +++ b/source4/lib/util.c @@ -23,6 +23,7 @@ */ #include "includes.h" +#include "dynconfig.h" #include "system/network.h" #include "system/iconv.h" diff --git a/source4/libcli/namequery.c b/source4/libcli/namequery.c index 2a67df5ffd..85270c1001 100644 --- a/source4/libcli/namequery.c +++ b/source4/libcli/namequery.c @@ -456,118 +456,6 @@ struct ipv4_addr *name_query(int fd,const char *name,int name_type, return ip_list; } -/******************************************************** - Start parsing the lmhosts file. -*********************************************************/ - -XFILE *startlmhosts(char *fname) -{ - XFILE *fp = x_fopen(fname,O_RDONLY, 0); - if (!fp) { - DEBUG(4,("startlmhosts: Can't open lmhosts file %s. Error was %s\n", - fname, strerror(errno))); - return NULL; - } - return fp; -} - -/******************************************************** - Parse the next line in the lmhosts file. -*********************************************************/ - -BOOL getlmhostsent( TALLOC_CTX *mem_ctx, - XFILE *fp, pstring name, int *name_type, struct ipv4_addr *ipaddr) -{ - pstring line; - - while(!x_feof(fp) && !x_ferror(fp)) { - pstring ip,flags,extra; - const char *ptr; - char *ptr1; - int count = 0; - - *name_type = -1; - - if (!fgets_slash(line,sizeof(pstring),fp)) - continue; - - if (*line == '#') - continue; - - pstrcpy(ip,""); - pstrcpy(name,""); - pstrcpy(flags,""); - - ptr = line; - - if (next_token(&ptr,ip ,NULL,sizeof(ip))) - ++count; - if (next_token(&ptr,name ,NULL, sizeof(pstring))) - ++count; - if (next_token(&ptr,flags,NULL, sizeof(flags))) - ++count; - if (next_token(&ptr,extra,NULL, sizeof(extra))) - ++count; - - if (count <= 0) - continue; - - if (count > 0 && count < 2) - { - DEBUG(0,("getlmhostsent: Ill formed hosts line [%s]\n",line)); - continue; - } - - if (count >= 4) - { - DEBUG(0,("getlmhostsent: too many columns in lmhosts file (obsolete syntax)\n")); - continue; - } - - DEBUG(4, ("getlmhostsent: lmhost entry: %s %s %s\n", ip, name, flags)); - - if (strchr_m(flags,'G') || strchr_m(flags,'S')) - { - DEBUG(0,("getlmhostsent: group flag in lmhosts ignored (obsolete)\n")); - continue; - } - - *ipaddr = interpret_addr2(ip); - - /* Extra feature. If the name ends in '#XX', where XX is a hex number, - then only add that name type. */ - if((ptr1 = strchr_m(name, '#')) != NULL) - { - char *endptr; - - ptr1++; - *name_type = (int)strtol(ptr1, &endptr, 16); - - if(!*ptr1 || (endptr == ptr1)) - { - DEBUG(0,("getlmhostsent: invalid name %s containing '#'.\n", name)); - continue; - } - - *(--ptr1) = '\0'; /* Truncate at the '#' */ - } - - return True; - } - - return False; -} - -/******************************************************** - Finish parsing the lmhosts file. -*********************************************************/ - -void endlmhosts(XFILE *fp) -{ - x_fclose(fp); -} - - /******************************************************** Resolve via "bcast" method. *********************************************************/ diff --git a/source4/nsswitch/winbind_nss_config.h b/source4/nsswitch/winbind_nss_config.h index 77d1dbe26e..06dda984ee 100644 --- a/source4/nsswitch/winbind_nss_config.h +++ b/source4/nsswitch/winbind_nss_config.h @@ -89,8 +89,7 @@ typedef char pstring[PSTRING_LEN]; typedef char fstring[FSTRING_LEN]; #endif -#ifndef _BOOL -#define _BOOL /* So we don't typedef BOOL again in vfs.h */ +#ifndef Auto #define False (0) #define True (1) #define Auto (2) diff --git a/source4/param/loadparm.c b/source4/param/loadparm.c index 37595c7a4f..c535509ca6 100644 --- a/source4/param/loadparm.c +++ b/source4/param/loadparm.c @@ -53,6 +53,7 @@ */ #include "includes.h" +#include "dynconfig.h" #include "system/time.h" #include "system/iconv.h" #include "system/network.h" diff --git a/source4/smbd/rewrite.c b/source4/smbd/rewrite.c index ff311c6680..44db95cdad 100644 --- a/source4/smbd/rewrite.c +++ b/source4/smbd/rewrite.c @@ -1,4 +1,5 @@ #include "includes.h" +#include "dynconfig.h" /* diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c index c7ed8eb771..07ad0929de 100644 --- a/source4/torture/gentest.c +++ b/source4/torture/gentest.c @@ -19,6 +19,7 @@ */ #include "includes.h" +#include "dynconfig.h" #include "system/time.h" #include "request.h" #include "libcli/raw/libcliraw.h" diff --git a/source4/torture/locktest.c b/source4/torture/locktest.c index 2461785512..6c55190d6b 100644 --- a/source4/torture/locktest.c +++ b/source4/torture/locktest.c @@ -19,6 +19,7 @@ */ #include "includes.h" +#include "dynconfig.h" #include "system/time.h" static int numops = 1000; diff --git a/source4/torture/masktest.c b/source4/torture/masktest.c index 964d000d49..ad5f703008 100644 --- a/source4/torture/masktest.c +++ b/source4/torture/masktest.c @@ -19,6 +19,7 @@ */ #include "includes.h" +#include "dynconfig.h" #include "client.h" #include "libcli/raw/libcliraw.h" #include "system/time.h" diff --git a/source4/torture/torture.c b/source4/torture/torture.c index 6d68f03967..656607d934 100644 --- a/source4/torture/torture.c +++ b/source4/torture/torture.c @@ -19,6 +19,7 @@ */ #include "includes.h" +#include "dynconfig.h" #include "client.h" #include "lib/cmdline/popt_common.h" #include "libcli/raw/libcliraw.h" diff --git a/source4/utils/net/net.c b/source4/utils/net/net.c index 3409101b71..380afd6120 100644 --- a/source4/utils/net/net.c +++ b/source4/utils/net/net.c @@ -42,6 +42,7 @@ /*****************************************************/ #include "includes.h" +#include "dynconfig.h" #include "utils/net/net.h" #include "lib/cmdline/popt_common.h" diff --git a/source4/utils/ntlm_auth.c b/source4/utils/ntlm_auth.c index 14f8e46b21..b038ad9879 100644 --- a/source4/utils/ntlm_auth.c +++ b/source4/utils/ntlm_auth.c @@ -23,6 +23,7 @@ */ #include "includes.h" +#include "dynconfig.h" #include "system/passwd.h" #include "lib/cmdline/popt_common.h" #include "auth/auth.h" -- cgit