r10513: Reduce some use of pstring. The main reason some parts of the code still
authorJelmer Vernooij <jelmer@samba.org>
Mon, 26 Sep 2005 16:57:08 +0000 (16:57 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:38:58 +0000 (13:38 -0500)
use pstring is next_token() now.
(This used to be commit a5b88bcd420eb7ae42283293541519e142be36e3)

13 files changed:
source4/auth/auth_developer.c
source4/auth/kerberos/kerberos.c
source4/auth/kerberos/kerberos_verify.c
source4/client/client.c
source4/include/enums.h
source4/include/includes.h
source4/lib/cmdline/popt_common.h
source4/lib/pidfile.c
source4/libcli/util/nterr.c
source4/param/loadparm.c
source4/passdb/secrets.c
source4/smb_server/smb_server.h
source4/utils/ntlm_auth.c

index 57bda22910940e5521e48b078ec009483f831a6a..a961d7efa14886eaf4c0e35362c760debe5db9d4 100644 (file)
@@ -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);
index 3935bfaf92af04bd130f2ca090d4ca17cf546718..62614f708159e84b16702769c7668af524778511 100644 (file)
@@ -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
index dec084299b1050a57ca4c0de85d69a7cf1c88049..514acde5ebad150fb195a41d3609208e3daa9043 100644 (file)
@@ -30,7 +30,6 @@
 #include "asn_1.h"
 #include "lib/ldb/include/ldb.h"
 #include "secrets.h"
-#include "pstring.h"
 
 #ifdef HAVE_KRB5
 
index 0bd4a4c98a7953cbedf4b695a3ef39d32350a901..ff41cba7e0a52fe671058a88a15a40df6399ea7c 100644 (file)
@@ -34,6 +34,7 @@
 #include "dlinklist.h"
 #include "credentials.h"
 #include "system/readline.h"
+#include "pstring.h"
 
 #ifndef REGISTER
 #define REGISTER 0
index e56f403a30f76cb4ef7ca6ac94049e036436baf9..4e8e7b04a0f62c1204e39b5432b94dd2cc36c481 100644 (file)
 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};
index 882c8e627740054f6dd94a9abe05f27d0b2dc67d..41452578ee3e4aa509b3cfacb9b66dc8437d44a3 100644 (file)
 #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
 
index 28676de56b07b5de7705b3a4ca513480f6b15c4e..785a50ae70c8bef28d2c7b166aac6afeb10f305e 100644 (file)
@@ -22,7 +22,6 @@
 #define _POPT_COMMON_H
 
 #include "popt.h"
-#include "pstring.h"
 
 /* Common popt structures */
 extern struct poptOption popt_common_samba[];
index b1866ee6af060be235a38576e315000fab6fad25..54d2c81d2e9c301a0fd5141295aaeeeada6afa64 100644 (file)
@@ -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);
 }
index 08cd844b3aef51f55947d7bd8354b72bc53f239d..ca8605faea1ae31837b34e4ea7ebc58018ba9138 100644 (file)
@@ -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;
 
index 1ea1ac48cd90efe59f43f85960d5410cc29c903c..7576b05d8358c3abedf0ed1adfe8f6fe4d6ae594 100644 (file)
@@ -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}
 };
 
index 13f82f61fd00c4f0aa9985db72729a337e05819f..9ebc836acf3b2f91fce1d9686731f2a9ec64e701 100644 (file)
@@ -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)
index 13dc056f864b9cd599709601d1bc17b48e94f12b..01fb1e26a3178a1dfcc3f15ca34b7760d360c76b 100644 (file)
@@ -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 
  */
index 87cd16daaa2816b24b8507efee5457b9201823e1..d2be631d9954e49835d2cbf81142565ae7e9339d 100644 (file)
@@ -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