diff options
author | Bruce Momjian <bruce@momjian.us> | 1999-03-16 04:26:01 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 1999-03-16 04:26:01 +0000 |
commit | 89b762e509285968b757e3376dfc6fdaab509a85 (patch) | |
tree | 5674f8f14d847b9d8a4cf08b04e9b421e653a816 /src/backend/commands/user.c | |
parent | 434762b55924c1414d5d66590a08dcabe865c9ac (diff) | |
download | postgresql-89b762e509285968b757e3376dfc6fdaab509a85.tar.gz postgresql-89b762e509285968b757e3376dfc6fdaab509a85.zip |
Fix snprintf with strings, and nextval('"Aa"');
Diffstat (limited to 'src/backend/commands/user.c')
-rw-r--r-- | src/backend/commands/user.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/backend/commands/user.c b/src/backend/commands/user.c index 65280df196d..e166a8b1c3b 100644 --- a/src/backend/commands/user.c +++ b/src/backend/commands/user.c @@ -5,7 +5,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: user.c,v 1.25 1999/03/16 03:24:16 momjian Exp $ + * $Id: user.c,v 1.26 1999/03/16 04:25:45 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -256,31 +256,33 @@ AlterUser(AlterUserStmt *stmt, CommandDest dest) if (stmt->password) { - snprintf(sql, SQL_LENGTH, "%s passwd = '%s'", sql, stmt->password); + snprintf(sql, SQL_LENGTH, "%s passwd = '%s'", pstrdup(sql), stmt->password); } if (stmt->createdb) { snprintf(sql, SQL_LENGTH, "%s %susecreatedb='%s'", - sql, stmt->password ? "," : "", *stmt->createdb ? "t" : "f"); + pstrdup(sql), stmt->password ? "," : "", + *stmt->createdb ? "t" : "f"); } if (stmt->createuser) { snprintf(sql, SQL_LENGTH, "%s %susesuper='%s'", - sql, (stmt->password || stmt->createdb) ? "," : "", + pstrdup(sql), (stmt->password || stmt->createdb) ? "," : "", *stmt->createuser ? "t" : "f"); } if (stmt->validUntil) { snprintf(sql, SQL_LENGTH, "%s %svaluntil='%s'", - sql, + pstrdup(sql), (stmt->password || stmt->createdb || stmt->createuser) ? "," : "", stmt->validUntil); } - snprintf(sql, SQL_LENGTH, "%s where usename = '%s'", sql, stmt->user); + snprintf(sql, SQL_LENGTH, "%s where usename = '%s'", + pstrdup(sql), stmt->user); pg_exec_query_dest(sql, dest, false); |