aboutsummaryrefslogtreecommitdiff
path: root/src/bin/scripts/createuser.c
Commit message (Collapse)AuthorAge
* Empty search_path in Autovacuum and non-psql/pgbench clients.Noah Misch2018-02-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes the client programs behave as documented regardless of the connect-time search_path and regardless of user-created objects. Today, a malicious user with CREATE permission on a search_path schema can take control of certain of these clients' queries and invoke arbitrary SQL functions under the client identity, often a superuser. This is exploitable in the default configuration, where all users have CREATE privilege on schema "public". This changes behavior of user-defined code stored in the database, like pg_index.indexprs and pg_extension_config_dump(). If they reach code bearing unqualified names, "does not exist" or "no schema has been selected to create in" errors might appear. Users may fix such errors by schema-qualifying affected names. After upgrading, consider watching server logs for these errors. The --table arguments of src/bin/scripts clients have been lax; for example, "vacuumdb -Zt pg_am\;CHECKPOINT" performed a checkpoint. That now fails, but for now, "vacuumdb -Zt 'pg_am(amname);CHECKPOINT'" still performs a checkpoint. Back-patch to 9.3 (all supported versions). Reviewed by Tom Lane, though this fix strategy was not his first choice. Reported by Arseniy Sharoglazov. Security: CVE-2018-1058
* Improve handling of password reuse in src/bin/scripts programs.Tom Lane2015-12-23
| | | | | | | | | | | | | | | | | This reverts most of commit 83dec5a71 in favor of having connectDatabase() store the possibly-reusable password in a static variable, similar to the coding we've had for a long time in pg_dump's version of that function. To avoid possible problems with unwanted password reuse, make callers specify whether it's reasonable to attempt to re-use the password. This is a wash for cases where re-use isn't needed, but it is far simpler for callers that do want that. Functionally there should be no difference. Even though we're past RC1, it seems like a good idea to back-patch this into 9.5, like the prior commit. Otherwise, if there are any third-party users of connectDatabase(), they'll have to deal with an API change in 9.5 and then another one in 9.6. Michael Paquier
* vacuumdb: don't prompt for passwords over and overAlvaro Herrera2015-11-12
| | | | | | | | | | | | | | | | | | | Having the script prompt for passwords over and over was a preexisting problem when it processed multiple databases or when it processed multiple analyze stages, but the parallel mode introduced in commit a179232047 made it worse. Fix the annoyance by keeping a copy of the password used by the first connection that requires one. Since users can (currently) only have a single password, there's no need for more complex arrangements (such as remembering one password per database). Per bug #13741 reported by Eric Brown. Patch authored and cross-reviewed by Haribabu Kommi and Michael Paquier, slightly tweaked by Álvaro Herrera. Discussion: http://www.postgresql.org/message-id/20151027193919.931.54948@wrigleys.postgresql.org Backpatch to 9.5, where parallel vacuumdb was introduced.
* Use appendStringInfoString/Char et al where appropriate.Heikki Linnakangas2015-07-02
| | | | | | Patch by David Rowley. Backpatch to 9.5, as some of the calls were new in 9.5, and keeping the code in sync with master makes future backpatching easier.
* Update copyright for 2015Bruce Momjian2015-01-06
| | | | Backpatch certain files through 9.0
* pgindent run for 9.4Bruce Momjian2014-05-06
| | | | | This includes removing tabs after periods in C comments, which was applied to back branches, so this change should not effect backpatching.
* scripts: Remove newlines from end of generated SQLPeter Eisentraut2014-02-10
| | | | | | | | | This results in spurious empty lines in the server log. Instead, add the newlines only when printing out the --echo output. In some cases, this was already done, leading to two newlines being printed. Clean that up as well. From: Fabrízio de Royes Mello <fabriziomello@gmail.com>
* Update copyright for 2014Bruce Momjian2014-01-07
| | | | | Update all files in head, and files COPYRIGHT and legal.sgml in all back branches.
* Fix incorrect error message reported for non-existent usersBruce Momjian2013-12-18
| | | | | | | | Previously, lookups of non-existent user names could return "Success"; it will now return "User does not exist" by resetting errno. This also centralizes the user name lookup code in libpgport. Report and analysis by Nicolas Marchildon; patch by me
* Add a new option, -g, to createuser, to add membership in a role.Robert Haas2013-12-11
| | | | | Chistopher Browne, reviewed by Sameer Thakur, Amit Kapila, and Peter Eisentraut.
* Replace appendPQExpBuffer(..., <constant>) with appendPQExpBufferStrHeikki Linnakangas2013-11-18
| | | | | | | Arguably makes the code a bit more readable, and might give a small performance gain. David Rowley
* Update copyrights for 2013Bruce Momjian2013-01-01
| | | | | Fully update git head, and update back branches in ./COPYRIGHT and legal.sgml files.
* In our source code, make a copy of getopt's 'optarg' string arguments,Bruce Momjian2012-10-12
| | | | rather than just storing a pointer.
* Make documentation of --help and --version options more consistentPeter Eisentraut2012-06-18
| | | | | | Before, some places didn't document the short options (-? and -V), some documented both, some documented nothing, and they were listed in various orders. Now this is hopefully more consistent and complete.
* createuser: Disable prompting by defaultPeter Eisentraut2012-02-07
| | | | | | | | | | Do not prompt when options were not specified. Assume --no-createdb, --no-createrole, --no-superuser by default. Also disable prompting for user name in dropdb, unless --interactive was specified. reviewed by Josh Kupershmidt
* Update copyright notices for year 2012.Bruce Momjian2012-01-01
|
* Make command-line tools smarter about finding a DB to connect to.Robert Haas2011-12-06
| | | | | | | | If unable to connect to "postgres", try "template1". This allows things to work more smoothly in the case where the postgres database has been dropped. And just in case that's not good enough, also allow the user to specify a maintenance database to be used for the initial connection, to cover the case where neither postgres nor template1 is suitable.
* Add --{no-,}replication flags to createuser.Robert Haas2011-09-23
| | | | Fujii Masao, reviewed by Cédric Villemain, with some doc changes by me.
* Stamp copyrights for year 2011.Bruce Momjian2011-01-01
|
* Remove cvs keywords from all files.Magnus Hagander2010-09-20
|
* Update copyright for the year 2010.Bruce Momjian2010-01-02
|
* Final removal of -q options, which haven't done anything since 8.3 andPeter Eisentraut2009-02-26
| | | | were marked for removal in 8.4.
* Add a -w/--no-password option that prevents all password prompts to allPeter Eisentraut2009-02-26
| | | | | | programs that have a -W/--password option. In passing, remove the ancient PSQL_ALWAYS_GET_PASSWORDS compile option.
* Sort the output of --help mostly alphabetical, make it align better, makePeter Eisentraut2009-02-25
| | | | help of pg_dump and pg_dumpall more similar.
* Update copyright for 2009.Bruce Momjian2009-01-01
|
* Append major version number and for libraries soname major version numberPeter Eisentraut2008-12-11
| | | | | | | to the gettext domain name, to simplify parallel installations. Also, rename set_text_domain() to pg_bindtextdomain(), because that is what it does.
* Update copyrights in source tree to 2008.Bruce Momjian2008-01-01
|
* Make documentation of -W options more accurate and uniform.Tom Lane2007-12-11
|
* Remove gratuitous response messages from utility programs.Peter Eisentraut2007-06-04
| | | | | | | | | | | | | | (Possibly release notes material, lest users be confused.) The --quiet option is now obsolete and without effect in createdb, createuser, dropdb, dropuser; kept for compatibility but marked for removal in 8.4. Progress messages when acting on all databases now go to stdout instead of stderr, since they are not in fact errors. Ordered options in reindexdb reference page alphabetically, like in other programs' pages.
* Update CVS HEAD for 2007 copyright. Back branches are typically notBruce Momjian2007-01-05
| | | | back-stamped for this.
* pgindent run for 8.2.Bruce Momjian2006-10-04
|
* Rearrange yes/no prompting code so that the prompts always show thePeter Eisentraut2006-09-22
| | | | | | | (possibly (un)translated) letters that are actually expected as input. Also reject invalid responses instead of silenty taken them as "no". with help from Bernd Helmle
* Fix up hack to suppress escape_string_warning so that it actually worksTom Lane2006-06-01
| | | | | | and there's only one place that's a kluge, ie, appendStringLiteralConn. Note that pg_dump itself doesn't use appendStringLiteralConn, so its behavior is not affected; only the other utility programs care.
* Escape processing patch:Bruce Momjian2006-05-31
| | | | | | | | | | o turns off escape_string_warning in pg_dumpall.c o optionally use E'' for \password (undocumented option?) o honor standard_conforming-strings for \copy (but not support literal E'' strings) o optionally use E'' for \d commands o turn off escape_string_warning for createdb, createuser, droplang
* Add PQclear() calls, for completeness (exits shortly anyway).Bruce Momjian2006-05-29
|
* Fix up pg_dump to do string escaping fully correctly for client encodingTom Lane2006-05-28
| | | | | | | | | and standard_conforming_strings; likewise for the other client programs that need it. As per previous discussion, a pg_dump dump now conforms to the standard_conforming_strings setting of the source database. We don't use E'' syntax in the dump, thereby improving portability of the SQL. I added a SET escape_strings_warning = off command to keep the dumps from getting a lot of back-chatter from that.
* Use E'' strings internally only when standard_conforming_strings =Bruce Momjian2006-05-26
| | | | | | | | | 'off'. This allows pg_dump output with standard_conforming_strings = 'on' to generate proper strings that can be loaded into other databases without the backslash doubling we typically do. I have added the dumping of the standard_conforming_strings value to pg_dump. I also added standard backslash handling for plpgsql.
* Update copyright for 2006. Update scripts.Bruce Momjian2006-03-05
|
* Rename pg_make_encrypted_password to PQencryptPassword.Peter Eisentraut2005-12-26
|
* Add an officially exported libpq function to encrypt passwords, andTom Lane2005-12-23
| | | | | modify the previous \password patch to use it instead of depending on a not-officially-exported function. Per discussion.
* Add new psql command \password for changing role password with client-sidePeter Eisentraut2005-12-18
| | | | password encryption. Also alter createuser command to the same effect.
* Use a proper enum for tri-valued variables.Bruce Momjian2005-12-12
|
* Document tri-valued variables in createdb, +1, -1, 0.Bruce Momjian2005-12-12
|
* Standard pgindent run for 8.1.Bruce Momjian2005-10-15
|
* Clean up the help displays.Peter Eisentraut2005-09-30
|
* Change the option spelling to --connection-limit to be consistent with thePeter Eisentraut2005-09-30
| | | | SQL option spelling.
* Update the createuser utility for the ROLEs world. Alvaro HerreraTom Lane2005-08-14
|
* Cause initdb to create a third standard database "postgres", whichTom Lane2005-06-21
| | | | | | | | | | | | | | unlike template0 and template1 does not have any special status in terms of backend functionality. However, all external utilities such as createuser and createdb now connect to "postgres" instead of template1, and the documentation is changed to encourage people to use "postgres" instead of template1 as a play area. This should fix some longstanding gotchas involving unexpected propagation of database objects by createdb (when you used template1 without understanding the implications), as well as ameliorating the problem that CREATE DATABASE is unhappy if anyone else is connected to template1. Patch by Dave Page, minor editing by Tom Lane. All per recent pghackers discussions.
* Tag appropriate files for rc3PostgreSQL Daemon2004-12-31
| | | | | | | | Also performed an initial run through of upgrading our Copyright date to extend to 2005 ... first run here was very simple ... change everything where: grep 1996-2004 && the word 'Copyright' ... scanned through the generated list with 'less' first, and after, to make sure that I only picked up the right entries ...
* Fix typoPeter Eisentraut2004-12-14
|