From 558de54ec6432a4ae90aa14a585f32c6cd03ced2 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 3 Nov 2004 00:17:12 +0000 Subject: [PATCH] r3494: got rid of include/rewrite.h, and split out the dynconfig.h header --- source/client/client.c | 1 + source/gtk/tools/gepdump.c | 7 +- source/gtk/tools/gregedit.c | 1 + source/gtk/tools/gwcrontab.c | 1 + source/gtk/tools/gwsam.c | 1 + source/include/charset.h | 13 ++++ source/include/includes.h | 17 ++-- source/include/pstring.h | 8 +- source/include/rewrite.h | 91 ---------------------- source/include/smb.h | 12 +++ source/ldap_server/ldap_rootdse.c | 1 + source/lib/cmdline/popt_common.c | 1 + source/lib/debug.c | 1 + source/lib/registry/tools/regdiff.c | 1 + source/lib/registry/tools/regpatch.c | 1 + source/lib/registry/tools/regshell.c | 1 + source/lib/registry/tools/regtree.c | 1 + source/lib/substitute.c | 1 + source/lib/util.c | 1 + source/libcli/namequery.c | 112 --------------------------- source/nsswitch/winbind_nss_config.h | 3 +- source/param/loadparm.c | 1 + source/smbd/rewrite.c | 1 + source/torture/gentest.c | 1 + source/torture/locktest.c | 1 + source/torture/masktest.c | 1 + source/torture/torture.c | 1 + source/utils/net/net.c | 1 + source/utils/ntlm_auth.c | 1 + 29 files changed, 66 insertions(+), 218 deletions(-) delete mode 100644 source/include/rewrite.h diff --git a/source/client/client.c b/source/client/client.c index 9c9b623920d..82377e82a94 100644 --- a/source/client/client.c +++ b/source/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/source/gtk/tools/gepdump.c b/source/gtk/tools/gepdump.c index 52e6bdad7db..1ad84b99f55 100644 --- a/source/gtk/tools/gepdump.c +++ b/source/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/source/gtk/tools/gregedit.c b/source/gtk/tools/gregedit.c index 10d9a127c44..f5c2fd59572 100644 --- a/source/gtk/tools/gregedit.c +++ b/source/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/source/gtk/tools/gwcrontab.c b/source/gtk/tools/gwcrontab.c index 38e4e11103c..b1176a3fa8b 100644 --- a/source/gtk/tools/gwcrontab.c +++ b/source/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/source/gtk/tools/gwsam.c b/source/gtk/tools/gwsam.c index cf8e1d5b5fe..18fd578f64c 100644 --- a/source/gtk/tools/gwsam.c +++ b/source/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/source/include/charset.h b/source/include/charset.h index 6c3ad2d916d..ba1402acb3c 100644 --- a/source/include/charset.h +++ b/source/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/source/include/includes.h b/source/include/includes.h index 78397faac65..9f2c233e739 100644 --- a/source/include/includes.h +++ b/source/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/source/include/pstring.h b/source/include/pstring.h index 92870e4cae5..5bd03ec0d8f 100644 --- a/source/include/pstring.h +++ b/source/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/source/include/rewrite.h b/source/include/rewrite.h deleted file mode 100644 index fa2168bed7e..00000000000 --- a/source/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/source/include/smb.h b/source/include/smb.h index bc9eb2acb8e..940af75671d 100644 --- a/source/include/smb.h +++ b/source/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/source/ldap_server/ldap_rootdse.c b/source/ldap_server/ldap_rootdse.c index db8be054678..2b9efa11b47 100644 --- a/source/ldap_server/ldap_rootdse.c +++ b/source/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/source/lib/cmdline/popt_common.c b/source/lib/cmdline/popt_common.c index 7d4dead4de5..6422b84b446 100644 --- a/source/lib/cmdline/popt_common.c +++ b/source/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/source/lib/debug.c b/source/lib/debug.c index 4f6ba125d35..f1e9cec38e8 100644 --- a/source/lib/debug.c +++ b/source/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/source/lib/registry/tools/regdiff.c b/source/lib/registry/tools/regdiff.c index c1b8d2949ed..80f4a5c49fb 100644 --- a/source/lib/registry/tools/regdiff.c +++ b/source/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/source/lib/registry/tools/regpatch.c b/source/lib/registry/tools/regpatch.c index ae4d331e3c9..38eabb60a9e 100644 --- a/source/lib/registry/tools/regpatch.c +++ b/source/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/source/lib/registry/tools/regshell.c b/source/lib/registry/tools/regshell.c index 583624fbab6..d705a0b8023 100644 --- a/source/lib/registry/tools/regshell.c +++ b/source/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/source/lib/registry/tools/regtree.c b/source/lib/registry/tools/regtree.c index 8fd73aef85b..a8225c026d9 100644 --- a/source/lib/registry/tools/regtree.c +++ b/source/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/source/lib/substitute.c b/source/lib/substitute.c index a01b90450a2..a351db1af21 100644 --- a/source/lib/substitute.c +++ b/source/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/source/lib/util.c b/source/lib/util.c index 5385174ce45..d8e9cb50f9c 100644 --- a/source/lib/util.c +++ b/source/lib/util.c @@ -23,6 +23,7 @@ */ #include "includes.h" +#include "dynconfig.h" #include "system/network.h" #include "system/iconv.h" diff --git a/source/libcli/namequery.c b/source/libcli/namequery.c index 2a67df5ffd2..85270c10019 100644 --- a/source/libcli/namequery.c +++ b/source/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/source/nsswitch/winbind_nss_config.h b/source/nsswitch/winbind_nss_config.h index 77d1dbe26e0..06dda984ee1 100644 --- a/source/nsswitch/winbind_nss_config.h +++ b/source/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/source/param/loadparm.c b/source/param/loadparm.c index 37595c7a4f1..c535509ca60 100644 --- a/source/param/loadparm.c +++ b/source/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/source/smbd/rewrite.c b/source/smbd/rewrite.c index ff311c6680d..44db95cdad0 100644 --- a/source/smbd/rewrite.c +++ b/source/smbd/rewrite.c @@ -1,4 +1,5 @@ #include "includes.h" +#include "dynconfig.h" /* diff --git a/source/torture/gentest.c b/source/torture/gentest.c index c7ed8eb7711..07ad0929dec 100644 --- a/source/torture/gentest.c +++ b/source/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/source/torture/locktest.c b/source/torture/locktest.c index 24617855127..6c55190d6b5 100644 --- a/source/torture/locktest.c +++ b/source/torture/locktest.c @@ -19,6 +19,7 @@ */ #include "includes.h" +#include "dynconfig.h" #include "system/time.h" static int numops = 1000; diff --git a/source/torture/masktest.c b/source/torture/masktest.c index 964d000d498..ad5f7030085 100644 --- a/source/torture/masktest.c +++ b/source/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/source/torture/torture.c b/source/torture/torture.c index 6d68f039672..656607d9344 100644 --- a/source/torture/torture.c +++ b/source/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/source/utils/net/net.c b/source/utils/net/net.c index 3409101b713..380afd61203 100644 --- a/source/utils/net/net.c +++ b/source/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/source/utils/ntlm_auth.c b/source/utils/ntlm_auth.c index 14f8e46b212..b038ad98793 100644 --- a/source/utils/ntlm_auth.c +++ b/source/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" -- 2.34.1