From 14ef4cdec1ab6be55c97d0f32780cbddbcdde218 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 15 Dec 2007 22:00:39 +0100 Subject: Replace sid_string_static with sid_to_string This adds 28 fstrings on the stack, but I think an fstring on the stack is still far better than a static one. (This used to be commit c7c885078be8fd3024c186044ac28275d7609679) --- source3/lib/privileges.c | 8 ++++---- source3/lib/substitute.c | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'source3/lib') diff --git a/source3/lib/privileges.c b/source3/lib/privileges.c index 3e2c756849..9f155acd8b 100644 --- a/source3/lib/privileges.c +++ b/source3/lib/privileges.c @@ -40,7 +40,7 @@ typedef struct { static bool get_privileges( const DOM_SID *sid, SE_PRIV *mask ) { TDB_CONTEXT *tdb = get_account_pol_tdb(); - fstring keystr; + fstring tmp, keystr; TDB_DATA data; /* Fail if the admin has not enable privileges */ @@ -54,7 +54,7 @@ static bool get_privileges( const DOM_SID *sid, SE_PRIV *mask ) /* PRIV_ (NULL terminated) as the key */ - fstr_sprintf( keystr, "%s%s", PRIVPREFIX, sid_string_static(sid) ); + fstr_sprintf(keystr, "%s%s", PRIVPREFIX, sid_to_string(tmp, sid)); data = tdb_fetch_bystring( tdb, keystr ); @@ -79,7 +79,7 @@ static bool get_privileges( const DOM_SID *sid, SE_PRIV *mask ) static bool set_privileges( const DOM_SID *sid, SE_PRIV *mask ) { TDB_CONTEXT *tdb = get_account_pol_tdb(); - fstring keystr; + fstring tmp, keystr; TDB_DATA data; if ( !lp_enable_privileges() ) @@ -95,7 +95,7 @@ static bool set_privileges( const DOM_SID *sid, SE_PRIV *mask ) /* PRIV_ (NULL terminated) as the key */ - fstr_sprintf( keystr, "%s%s", PRIVPREFIX, sid_string_static(sid) ); + fstr_sprintf(keystr, "%s%s", PRIVPREFIX, sid_to_string(tmp, sid)); /* no packing. static size structure, just write it out */ diff --git a/source3/lib/substitute.c b/source3/lib/substitute.c index b456b9b992..3fbdd2859e 100644 --- a/source3/lib/substitute.c +++ b/source3/lib/substitute.c @@ -302,13 +302,14 @@ static char * realloc_expand_env_var(char *str, char *p) static char *longvar_domainsid( void ) { DOM_SID sid; + fstring tmp; char *sid_string; if ( !secrets_fetch_domain_sid( lp_workgroup(), &sid ) ) { return NULL; } - sid_string = SMB_STRDUP( sid_string_static( &sid ) ); + sid_string = SMB_STRDUP( sid_to_string( tmp, &sid ) ); if ( !sid_string ) { DEBUG(0,("longvar_domainsid: failed to dup SID string!\n")); -- cgit