diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2005-09-26 16:57:08 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:38:58 -0500 |
commit | 49839f356f493d0de1b719c8c3bfdee4713c0728 (patch) | |
tree | 62055f766b1dea0f06a623e8454d22994dd500f2 | |
parent | f801ad359290c51d3216c755fb2a8344babb484f (diff) | |
download | samba-49839f356f493d0de1b719c8c3bfdee4713c0728.tar.gz samba-49839f356f493d0de1b719c8c3bfdee4713c0728.tar.bz2 samba-49839f356f493d0de1b719c8c3bfdee4713c0728.zip |
r10513: Reduce some use of pstring. The main reason some parts of the code still
use pstring is next_token() now.
(This used to be commit a5b88bcd420eb7ae42283293541519e142be36e3)
-rw-r--r-- | source4/auth/auth_developer.c | 6 | ||||
-rw-r--r-- | source4/auth/kerberos/kerberos.c | 1 | ||||
-rw-r--r-- | source4/auth/kerberos/kerberos_verify.c | 1 | ||||
-rw-r--r-- | source4/client/client.c | 1 | ||||
-rw-r--r-- | source4/include/enums.h | 27 | ||||
-rw-r--r-- | source4/include/includes.h | 5 | ||||
-rw-r--r-- | source4/lib/cmdline/popt_common.h | 1 | ||||
-rw-r--r-- | source4/lib/pidfile.c | 13 | ||||
-rw-r--r-- | source4/libcli/util/nterr.c | 2 | ||||
-rw-r--r-- | source4/param/loadparm.c | 5 | ||||
-rw-r--r-- | source4/passdb/secrets.c | 10 | ||||
-rw-r--r-- | source4/smb_server/smb_server.h | 3 | ||||
-rw-r--r-- | source4/utils/ntlm_auth.c | 1 |
13 files changed, 23 insertions, 53 deletions
diff --git a/source4/auth/auth_developer.c b/source4/auth/auth_developer.c index 57bda22910..a961d7efa1 100644 --- a/source4/auth/auth_developer.c +++ b/source4/auth/auth_developer.c @@ -24,7 +24,6 @@ #include "auth/auth.h" #include "librpc/gen_ndr/ndr_samr.h" #include "librpc/gen_ndr/ndr_security.h" -#include "pstring.h" /** * Return an error based on username @@ -46,9 +45,10 @@ static NTSTATUS name_to_ntstatus_check_password(struct auth_method_context *ctx, { NTSTATUS nt_status; struct auth_serversupplied_info *server_info; - fstring user; uint32_t error_num; - fstrcpy(user, user_info->client.account_name); + const char *user; + + user = user_info->client.account_name; if (strncasecmp("NT_STATUS", user, strlen("NT_STATUS")) == 0) { nt_status = nt_status_string_to_code(user); diff --git a/source4/auth/kerberos/kerberos.c b/source4/auth/kerberos/kerberos.c index 3935bfaf92..62614f7081 100644 --- a/source4/auth/kerberos/kerberos.c +++ b/source4/auth/kerberos/kerberos.c @@ -28,7 +28,6 @@ #include "system/time.h" #include "auth/kerberos/kerberos.h" #include "secrets.h" -#include "pstring.h" #include "ads.h" #ifdef HAVE_KRB5 diff --git a/source4/auth/kerberos/kerberos_verify.c b/source4/auth/kerberos/kerberos_verify.c index dec084299b..514acde5eb 100644 --- a/source4/auth/kerberos/kerberos_verify.c +++ b/source4/auth/kerberos/kerberos_verify.c @@ -30,7 +30,6 @@ #include "asn_1.h" #include "lib/ldb/include/ldb.h" #include "secrets.h" -#include "pstring.h" #ifdef HAVE_KRB5 diff --git a/source4/client/client.c b/source4/client/client.c index 0bd4a4c98a..ff41cba7e0 100644 --- a/source4/client/client.c +++ b/source4/client/client.c @@ -34,6 +34,7 @@ #include "dlinklist.h" #include "credentials.h" #include "system/readline.h" +#include "pstring.h" #ifndef REGISTER #define REGISTER 0 diff --git a/source4/include/enums.h b/source4/include/enums.h index e56f403a30..4e8e7b04a0 100644 --- a/source4/include/enums.h +++ b/source4/include/enums.h @@ -27,29 +27,4 @@ enum protocol_types {PROTOCOL_NONE,PROTOCOL_CORE,PROTOCOL_COREPLUS,PROTOCOL_LANMAN1,PROTOCOL_LANMAN2,PROTOCOL_NT1}; /* security levels */ -enum security_types {SEC_SHARE,SEC_USER,SEC_SERVER,SEC_DOMAIN,SEC_ADS}; - -/* printing types */ -enum printing_types {PRINT_BSD,PRINT_SYSV,PRINT_AIX,PRINT_HPUX, - PRINT_QNX,PRINT_PLP,PRINT_LPRNG,PRINT_SOFTQ, - PRINT_CUPS,PRINT_LPRNT,PRINT_LPROS2 -#ifdef DEVELOPER -,PRINT_TEST,PRINT_VLP -#endif /* DEVELOPER */ -}; - -/* LDAP schema types */ -enum schema_types {SCHEMA_COMPAT, SCHEMA_AD, SCHEMA_SAMBA}; - -/* LDAP SSL options */ -enum ldap_ssl_types {LDAP_SSL_ON, LDAP_SSL_OFF, LDAP_SSL_START_TLS}; - -/* LDAP PASSWD SYNC methods */ -enum ldap_passwd_sync_types {LDAP_PASSWD_SYNC_ON, LDAP_PASSWD_SYNC_OFF, LDAP_PASSWD_SYNC_ONLY}; - -/* Remote architectures we know about. */ -enum remote_arch_types {RA_UNKNOWN, RA_WFWG, RA_OS2, RA_WIN95, RA_WINNT, RA_WIN2K, RA_WINXP, RA_SAMBA}; - -/* case handling */ -enum case_handling {CASE_LOWER,CASE_UPPER}; - +enum security_types {SEC_SHARE,SEC_USER}; diff --git a/source4/include/includes.h b/source4/include/includes.h index 882c8e6277..41452578ee 100644 --- a/source4/include/includes.h +++ b/source4/include/includes.h @@ -64,11 +64,6 @@ #include <varargs.h> #endif -/* we support ADS if we want it and have krb5 and ldap libs */ -#if defined(WITH_ADS) && defined(HAVE_KRB5) && defined(HAVE_LDAP) -#define HAVE_ADS -#endif - /* tell ldb we have the internal ldap code */ #define HAVE_ILDAP 1 diff --git a/source4/lib/cmdline/popt_common.h b/source4/lib/cmdline/popt_common.h index 28676de56b..785a50ae70 100644 --- a/source4/lib/cmdline/popt_common.h +++ b/source4/lib/cmdline/popt_common.h @@ -22,7 +22,6 @@ #define _POPT_COMMON_H #include "popt.h" -#include "pstring.h" /* Common popt structures */ extern struct poptOption popt_common_samba[]; diff --git a/source4/lib/pidfile.c b/source4/lib/pidfile.c index b1866ee6af..54d2c81d2e 100644 --- a/source4/lib/pidfile.c +++ b/source4/lib/pidfile.c @@ -21,7 +21,6 @@ */ #include "includes.h" -#include "pstring.h" #include "system/filesys.h" #ifndef O_NONBLOCK @@ -35,11 +34,13 @@ pid_t pidfile_pid(const char *name) int fd; char pidstr[20]; uint_t ret; - pstring pidFile; + char *pidFile; - slprintf(pidFile, sizeof(pidFile)-1, "%s/%s.pid", lp_piddir(), name); + asprintf(&pidFile, "%s/%s.pid", lp_piddir(), name); fd = open(pidFile, O_NONBLOCK | O_RDONLY, 0644); + SAFE_FREE(pidFile); + if (fd == -1) { return 0; } @@ -75,10 +76,10 @@ void pidfile_create(const char *name) { int fd; char buf[20]; - pstring pidFile; + char *pidFile; pid_t pid; - slprintf(pidFile, sizeof(pidFile)-1, "%s/%s.pid", lp_piddir(), name); + asprintf(&pidFile, "%s/%s.pid", lp_piddir(), name); pid = pidfile_pid(name); if (pid != 0) { @@ -107,5 +108,7 @@ void pidfile_create(const char *name) pidFile, strerror(errno))); exit(1); } + /* Leave pid file open & locked for the duration... */ + SAFE_FREE(pidFile); } diff --git a/source4/libcli/util/nterr.c b/source4/libcli/util/nterr.c index 08cd844b3a..ca8605faea 100644 --- a/source4/libcli/util/nterr.c +++ b/source4/libcli/util/nterr.c @@ -835,7 +835,7 @@ const char *get_nt_error_c_code(NTSTATUS nt_code) /***************************************************************************** returns the NT_STATUS constant matching the string supplied (as an NTSTATUS) *****************************************************************************/ -NTSTATUS nt_status_string_to_code(char *nt_status_str) +NTSTATUS nt_status_string_to_code(const char *nt_status_str) { int idx = 0; diff --git a/source4/param/loadparm.c b/source4/param/loadparm.c index 1ea1ac48cd..7576b05d83 100644 --- a/source4/param/loadparm.c +++ b/source4/param/loadparm.c @@ -297,11 +297,6 @@ static const struct enum_list enum_protocol[] = { static const struct enum_list enum_security[] = { {SEC_SHARE, "SHARE"}, {SEC_USER, "USER"}, - {SEC_SERVER, "SERVER"}, - {SEC_DOMAIN, "DOMAIN"}, -#ifdef HAVE_ADS - {SEC_ADS, "ADS"}, -#endif {-1, NULL} }; diff --git a/source4/passdb/secrets.c b/source4/passdb/secrets.c index 13f82f61fd..9ebc836acf 100644 --- a/source4/passdb/secrets.c +++ b/source4/passdb/secrets.c @@ -26,7 +26,6 @@ #include "lib/tdb/include/tdbutil.h" #include "secrets.h" #include "system/filesys.h" -#include "pstring.h" #include "db_wrap.h" #include "lib/ldb/include/ldb.h" @@ -57,21 +56,22 @@ void secrets_shutdown(void) /* open up the secrets database */ BOOL secrets_init(void) { - pstring fname; + char *fname; uint8_t dummy; if (tdb) return True; - pstrcpy(fname, lp_private_dir()); - pstrcat(fname,"/secrets.tdb"); + asprintf(&fname, "%s/secrets.tdb", lp_private_dir()); tdb = tdb_wrap_open(talloc_autofree_context(), fname, 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600); if (!tdb) { DEBUG(0,("Failed to open %s\n", fname)); + SAFE_FREE(fname); return False; } + SAFE_FREE(fname); /** * Set a reseed function for the crypto random generator @@ -96,7 +96,7 @@ static void *secrets_fetch(const char *key, size_t *size) secrets_init(); if (!tdb) return NULL; - kbuf.dptr = strdup(key); + kbuf.dptr = (uint8_t *)strdup(key); kbuf.dsize = strlen(key); dbuf = tdb_fetch(tdb->tdb, kbuf); if (size) diff --git a/source4/smb_server/smb_server.h b/source4/smb_server/smb_server.h index 13dc056f86..01fb1e26a3 100644 --- a/source4/smb_server/smb_server.h +++ b/source4/smb_server/smb_server.h @@ -152,6 +152,9 @@ struct substitute_context { char *user_name; }; +/* Remote architectures we know about. */ +enum remote_arch_types {RA_UNKNOWN, RA_WFWG, RA_OS2, RA_WIN95, RA_WINNT, RA_WIN2K, RA_WINXP, RA_SAMBA}; + /* smb server context structure. This should contain all the state * information associated with a SMB server connection */ diff --git a/source4/utils/ntlm_auth.c b/source4/utils/ntlm_auth.c index 87cd16daaa..d2be631d99 100644 --- a/source4/utils/ntlm_auth.c +++ b/source4/utils/ntlm_auth.c @@ -29,6 +29,7 @@ #include "auth/auth.h" #include "librpc/gen_ndr/ndr_security.h" #include "credentials.h" +#include "pstring.h" #define SQUID_BUFFER_SIZE 2010 |