From 33d83175715d2179588c774259fd707c6daea2f9 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl@sernet.de>
Date: Sun, 4 Nov 2007 18:15:37 +0100
Subject: static pstring removal (This used to be commit
 5490e2d77233f594a42cb32eda8215014db544e3)

---
 source3/passdb/passdb.c   |  7 +++++--
 source3/passdb/pdb_ldap.c |  8 ++++++--
 source3/passdb/pdb_tdb.c  |  4 ++--
 source3/passdb/secrets.c  | 14 +++++++++-----
 4 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c
index 9254aba715..e1e5967af3 100644
--- a/source3/passdb/passdb.c
+++ b/source3/passdb/passdb.c
@@ -261,7 +261,8 @@ NTSTATUS samu_alloc_rid_unix(struct samu *user, const struct passwd *pwd)
 
 char *pdb_encode_acct_ctrl(uint32 acct_ctrl, size_t length)
 {
-	static fstring acct_str;
+	fstring acct_str;
+	char *result;
 
 	size_t i = 0;
 
@@ -288,7 +289,9 @@ char *pdb_encode_acct_ctrl(uint32 acct_ctrl, size_t length)
 	acct_str[i++] = ']';
 	acct_str[i++] = '\0';
 
-	return acct_str;
+	result = talloc_strdup(talloc_tos(), acct_str);
+	SMB_ASSERT(result != NULL);
+	return result;
 }     
 
 /**********************************************************
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c
index 53bca864d8..0c60e3f63f 100644
--- a/source3/passdb/pdb_ldap.c
+++ b/source3/passdb/pdb_ldap.c
@@ -159,7 +159,8 @@ static const char** get_userattr_delete_list( TALLOC_CTX *mem_ctx,
 
 static const char* get_objclass_filter( int schema_ver )
 {
-	static fstring objclass_filter;
+	fstring objclass_filter;
+	char *result;
 	
 	switch( schema_ver ) {
 		case SCHEMAVER_SAMBAACCOUNT:
@@ -170,10 +171,13 @@ static const char* get_objclass_filter( int schema_ver )
 			break;
 		default:
 			DEBUG(0,("get_objclass_filter: Invalid schema version specified!\n"));
+			objclass_filter[0] = '\0';
 			break;
 	}
 	
-	return objclass_filter;	
+	result = talloc_strdup(talloc_tos(), objclass_filter);
+	SMB_ASSERT(result != NULL);
+	return result;
 }
 
 /*****************************************************************
diff --git a/source3/passdb/pdb_tdb.c b/source3/passdb/pdb_tdb.c
index 79427a587c..099b443072 100644
--- a/source3/passdb/pdb_tdb.c
+++ b/source3/passdb/pdb_tdb.c
@@ -55,7 +55,7 @@ static bool pwent_initialized;
 
 static TDB_CONTEXT *tdbsam;
 static int ref_count = 0;
-static pstring tdbsam_filename;
+static char *tdbsam_filename;
 
 /**********************************************************************
  Marshall/unmarshall struct samu structs.
@@ -1609,7 +1609,7 @@ static NTSTATUS pdb_init_tdbsam(struct pdb_methods **pdb_method, const char *loc
 		pstr_sprintf( tdbfile, "%s/%s", dyn_STATEDIR(), PASSDB_FILE_NAME );
 		pfile = tdbfile;
 	}
-	pstrcpy( tdbsam_filename, pfile );
+	tdbsam_filename = SMB_STRDUP(pfile);
 
 	/* no private data */
 	
diff --git a/source3/passdb/secrets.c b/source3/passdb/secrets.c
index 512c3de9f0..a7221df6df 100644
--- a/source3/passdb/secrets.c
+++ b/source3/passdb/secrets.c
@@ -209,10 +209,12 @@ bool secrets_fetch_domain_guid(const char *domain, struct GUID *guid)
  **/
 static const char *trust_keystr(const char *domain)
 {
-	static fstring keystr;
+	char *keystr;
+
+	keystr = talloc_asprintf(talloc_tos(), "%s/%s",
+				 SECRETS_MACHINE_ACCT_PASS, domain);
+	SMB_ASSERT(keystr != NULL);
 
-	slprintf(keystr,sizeof(keystr)-1,"%s/%s",
-		 SECRETS_MACHINE_ACCT_PASS, domain);
 	strupper_m(keystr);
 
 	return keystr;
@@ -227,9 +229,11 @@ static const char *trust_keystr(const char *domain)
  **/
 static char *trustdom_keystr(const char *domain)
 {
-	static pstring keystr;
+	char *keystr;
 
-	pstr_sprintf(keystr, "%s/%s", SECRETS_DOMTRUST_ACCT_PASS, domain);
+	keystr = talloc_asprintf(talloc_tos(), "%s/%s",
+				 SECRETS_DOMTRUST_ACCT_PASS, domain);
+	SMB_ASSERT(keystr != NULL);
 	strupper_m(keystr);
 
 	return keystr;
-- 
cgit