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

Commit3ac9688

Browse files
committed
I also noticed that pg_dump contains a copy of the same
prompt_for_password code that psql does. We fixed psql a month ortwo back to permit usernames and passwords longer than 8 characters.I propagated the same fix into pg_dump.Tom Lane
1 parent087eb4c commit3ac9688

File tree

2 files changed

+33
-12
lines changed

2 files changed

+33
-12
lines changed

‎src/bin/pg_dump/common.c

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/bin/pg_dump/common.c,v 1.24 1998/09/01 04:33:43 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/bin/pg_dump/common.c,v 1.25 1998/09/20 03:18:42 momjian Exp $
1111
*
1212
* Modifications - 6/12/96 - dave@bensoft.com - version 1.13.dhb.2
1313
*
@@ -116,7 +116,8 @@ findParentsByOid(TableInfo *tblinfo, int numTables,
116116
{
117117
inti,
118118
j;
119-
intparentInd;
119+
intparentInd,
120+
selfInd;
120121
char**result;
121122
intnumParents;
122123

@@ -139,6 +140,16 @@ findParentsByOid(TableInfo *tblinfo, int numTables,
139140
{
140141
parentInd=findTableByOid(tblinfo,numTables,
141142
inhinfo[i].inhparent);
143+
if (parentInd<0)
144+
{
145+
selfInd=findTableByOid(tblinfo,numTables,oid);
146+
fprintf(stderr,
147+
"failed sanity check, parent oid %s of table %s (oid %s) was not found\n",
148+
inhinfo[i].inhparent,
149+
(selfInd >=0) ?tblinfo[selfInd].relname :"",
150+
oid);
151+
exit(2);
152+
}
142153
result[j++]=tblinfo[parentInd].relname;
143154
}
144155
}
@@ -387,6 +398,13 @@ flagInhAttrs(TableInfo *tblinfo, int numTables,
387398
{
388399
parentInd=findTableByName(tblinfo,numTables,
389400
tblinfo[i].parentRels[k]);
401+
if (parentInd<0)
402+
{
403+
/* shouldn't happen unless findParentsByOid is broken */
404+
fprintf(stderr,"failed sanity check, table %s not found by flagInhAttrs\n",
405+
tblinfo[i].parentRels[k]);
406+
exit(2);
407+
}
390408
for (j=0;j<tblinfo[i].numatts;j++)
391409
{
392410
if (strInArray(tblinfo[i].attnames[j],

‎src/bin/pg_dump/pg_dump.c

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*
2222
*
2323
* IDENTIFICATION
24-
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.84 1998/09/03 02:10:36 momjian Exp $
24+
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.85 1998/09/20 03:18:43 momjian Exp $
2525
*
2626
* Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
2727
*
@@ -472,6 +472,7 @@ dumpClasses(const TableInfo *tblinfo, const int numTables, FILE *fout,
472472
staticvoid
473473
prompt_for_password(char*username,char*password)
474474
{
475+
charbuf[512];
475476
intlength;
476477

477478
#ifdefHAVE_TERMIOS_H
@@ -481,13 +482,11 @@ prompt_for_password(char *username, char *password)
481482
#endif
482483

483484
printf("Username: ");
484-
fgets(username,9,stdin);
485+
fgets(username,100,stdin);
485486
length=strlen(username);
486487
/* skip rest of the line */
487488
if (length>0&&username[length-1]!='\n')
488489
{
489-
staticcharbuf[512];
490-
491490
do
492491
{
493492
fgets(buf,512,stdin);
@@ -503,7 +502,7 @@ prompt_for_password(char *username, char *password)
503502
t.c_lflag &= ~ECHO;
504503
tcsetattr(0,TCSADRAIN,&t);
505504
#endif
506-
fgets(password,9,stdin);
505+
fgets(password,100,stdin);
507506
#ifdefHAVE_TERMIOS_H
508507
tcsetattr(0,TCSADRAIN,&t_orig);
509508
#endif
@@ -512,8 +511,6 @@ prompt_for_password(char *username, char *password)
512511
/* skip rest of the line */
513512
if (length>0&&password[length-1]!='\n')
514513
{
515-
staticcharbuf[512];
516-
517514
do
518515
{
519516
fgets(buf,512,stdin);
@@ -541,8 +538,8 @@ main(int argc, char **argv)
541538
intnumTables;
542539
charconnect_string[512]="";
543540
chartmp_string[128];
544-
charusername[64];
545-
charpassword[64];
541+
charusername[100];
542+
charpassword[100];
546543
intuse_password=0;
547544

548545
g_verbose= false;
@@ -2584,7 +2581,13 @@ dumpIndices(FILE *fout, IndInfo *indinfo, int numIndices,
25842581
for (i=0;i<numIndices;i++)
25852582
{
25862583
tableInd=findTableByName(tblinfo,numTables,
2587-
(indinfo[i].indrelname));
2584+
indinfo[i].indrelname);
2585+
if (tableInd<0)
2586+
{
2587+
fprintf(stderr,"failed sanity check, table %s was not found\n",
2588+
indinfo[i].indrelname);
2589+
exit(2);
2590+
}
25882591

25892592
if (strcmp(indinfo[i].indproc,"0")==0)
25902593
funcname=NULL;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp