Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb5fe16d

Browse files
committed
make initdb -U username work as advertised; back out bogus patch at rev 1.42and supply real fix for problem it tried to address.
1 parentf87d487 commitb5fe16d

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

‎src/bin/initdb/initdb.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
* Portions Copyright (c) 1994, Regents of the University of California
4343
* Portions taken from FreeBSD.
4444
*
45-
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.110 2006/02/18 16:15:23 petere Exp $
45+
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.111 2006/02/24 00:55:49 adunstan Exp $
4646
*
4747
*-------------------------------------------------------------------------
4848
*/
@@ -113,7 +113,6 @@ static char *conversion_file;
113113
staticchar*info_schema_file;
114114
staticchar*features_file;
115115
staticchar*system_views_file;
116-
staticchar*effective_user;
117116
staticboolmade_new_pgdata= false;
118117
staticboolfound_existing_pgdata= false;
119118
staticcharinfoversion[100];
@@ -1385,7 +1384,7 @@ bootstrap_template1(char *short_version)
13851384
exit_nicely();
13861385
}
13871386

1388-
bki_lines=replace_token(bki_lines,"POSTGRES",effective_user);
1387+
bki_lines=replace_token(bki_lines,"POSTGRES",username);
13891388

13901389
bki_lines=replace_token(bki_lines,"ENCODING",encodingid);
13911390

@@ -1547,7 +1546,7 @@ get_set_pwd(void)
15471546
PG_CMD_OPEN;
15481547

15491548
PG_CMD_PRINTF2("ALTER USER \"%s\" WITH PASSWORD '%s';\n",
1550-
effective_user,pwd1);
1549+
username,pwd1);
15511550

15521551
PG_CMD_CLOSE;
15531552

@@ -1866,7 +1865,7 @@ setup_privileges(void)
18661865
PG_CMD_OPEN;
18671866

18681867
priv_lines=replace_token(privileges_setup,
1869-
"$POSTGRES_SUPERUSERNAME",effective_user);
1868+
"$POSTGRES_SUPERUSERNAME",username);
18701869
for (line=priv_lines;*line!=NULL;line++)
18711870
PG_CMD_PUTS(*line);
18721871

@@ -2446,6 +2445,7 @@ main(int argc, char *argv[])
24462445
ret;
24472446
intoption_index;
24482447
char*short_version;
2448+
char*effective_user;
24492449
char*pgdenv;/* PGDATA value gotten from and sent to
24502450
* environment */
24512451
charbin_dir[MAXPGPATH];
@@ -2735,10 +2735,10 @@ main(int argc, char *argv[])
27352735
exit(1);
27362736
}
27372737

2738-
if (strlen(username))
2739-
effective_user=username;
2740-
else
2741-
effective_user=get_id();
2738+
effective_user=get_id();
2739+
if (strlen(username)==0)
2740+
username=effective_user;
2741+
27422742

27432743
if (strlen(encoding))
27442744
encodingid=get_encoding_id(encoding);
@@ -2767,7 +2767,7 @@ main(int argc, char *argv[])
27672767
"PG_HBA_SAMPLE=%s\nPG_IDENT_SAMPLE=%s\n",
27682768
PG_VERSION,
27692769
pg_data,share_path,bin_path,
2770-
effective_user,bki_file,
2770+
username,bki_file,
27712771
desc_file,shdesc_file,
27722772
conf_file,
27732773
hba_file,ident_file);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp