|
42 | 42 | * Portions Copyright (c) 1994, Regents of the University of California
|
43 | 43 | * Portions taken from FreeBSD.
|
44 | 44 | *
|
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 $ |
46 | 46 | *
|
47 | 47 | *-------------------------------------------------------------------------
|
48 | 48 | */
|
@@ -113,7 +113,6 @@ static char *conversion_file;
|
113 | 113 | staticchar*info_schema_file;
|
114 | 114 | staticchar*features_file;
|
115 | 115 | staticchar*system_views_file;
|
116 |
| -staticchar*effective_user; |
117 | 116 | staticboolmade_new_pgdata= false;
|
118 | 117 | staticboolfound_existing_pgdata= false;
|
119 | 118 | staticcharinfoversion[100];
|
@@ -1385,7 +1384,7 @@ bootstrap_template1(char *short_version)
|
1385 | 1384 | exit_nicely();
|
1386 | 1385 | }
|
1387 | 1386 |
|
1388 |
| -bki_lines=replace_token(bki_lines,"POSTGRES",effective_user); |
| 1387 | +bki_lines=replace_token(bki_lines,"POSTGRES",username); |
1389 | 1388 |
|
1390 | 1389 | bki_lines=replace_token(bki_lines,"ENCODING",encodingid);
|
1391 | 1390 |
|
@@ -1547,7 +1546,7 @@ get_set_pwd(void)
|
1547 | 1546 | PG_CMD_OPEN;
|
1548 | 1547 |
|
1549 | 1548 | PG_CMD_PRINTF2("ALTER USER \"%s\" WITH PASSWORD '%s';\n",
|
1550 |
| -effective_user,pwd1); |
| 1549 | +username,pwd1); |
1551 | 1550 |
|
1552 | 1551 | PG_CMD_CLOSE;
|
1553 | 1552 |
|
@@ -1866,7 +1865,7 @@ setup_privileges(void)
|
1866 | 1865 | PG_CMD_OPEN;
|
1867 | 1866 |
|
1868 | 1867 | priv_lines=replace_token(privileges_setup,
|
1869 |
| -"$POSTGRES_SUPERUSERNAME",effective_user); |
| 1868 | +"$POSTGRES_SUPERUSERNAME",username); |
1870 | 1869 | for (line=priv_lines;*line!=NULL;line++)
|
1871 | 1870 | PG_CMD_PUTS(*line);
|
1872 | 1871 |
|
@@ -2446,6 +2445,7 @@ main(int argc, char *argv[])
|
2446 | 2445 | ret;
|
2447 | 2446 | intoption_index;
|
2448 | 2447 | char*short_version;
|
| 2448 | +char*effective_user; |
2449 | 2449 | char*pgdenv;/* PGDATA value gotten from and sent to
|
2450 | 2450 | * environment */
|
2451 | 2451 | charbin_dir[MAXPGPATH];
|
@@ -2735,10 +2735,10 @@ main(int argc, char *argv[])
|
2735 | 2735 | exit(1);
|
2736 | 2736 | }
|
2737 | 2737 |
|
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 | + |
2742 | 2742 |
|
2743 | 2743 | if (strlen(encoding))
|
2744 | 2744 | encodingid=get_encoding_id(encoding);
|
@@ -2767,7 +2767,7 @@ main(int argc, char *argv[])
|
2767 | 2767 | "PG_HBA_SAMPLE=%s\nPG_IDENT_SAMPLE=%s\n",
|
2768 | 2768 | PG_VERSION,
|
2769 | 2769 | pg_data,share_path,bin_path,
|
2770 |
| -effective_user,bki_file, |
| 2770 | +username,bki_file, |
2771 | 2771 | desc_file,shdesc_file,
|
2772 | 2772 | conf_file,
|
2773 | 2773 | hba_file,ident_file);
|
|