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

Commit175f520

Browse files
committed
aclitemout() shouldn't coredump when it finds an ACL item
for a now-vanished group. Instead, display the numeric group ID, sameas it does for vanished users.
1 parentc715fde commit175f520

File tree

2 files changed

+25
-13
lines changed

2 files changed

+25
-13
lines changed

‎src/backend/catalog/aclchk.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.43 2000/11/16 22:30:17 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.44 2000/11/28 23:42:31 tgl Exp $
1212
*
1313
* NOTES
1414
* See acl.h.
@@ -172,6 +172,9 @@ get_grosysid(char *groname)
172172
returnid;
173173
}
174174

175+
/*
176+
* Convert group ID to name, or return NULL if group can't be found
177+
*/
175178
char*
176179
get_groname(AclIdgrosysid)
177180
{
@@ -186,8 +189,6 @@ get_groname(AclId grosysid)
186189
name=pstrdup(NameStr(((Form_pg_group)GETSTRUCT(tuple))->groname));
187190
ReleaseSysCache(tuple);
188191
}
189-
else
190-
elog(NOTICE,"get_groname: group %u not found",grosysid);
191192
returnname;
192193
}
193194

‎src/backend/utils/adt/acl.c

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.53 2000/11/16 22:30:31 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.54 2000/11/28 23:42:31 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -276,7 +276,14 @@ aclitemout(PG_FUNCTION_ARGS)
276276
htup=SearchSysCache(SHADOWSYSID,
277277
ObjectIdGetDatum(aip->ai_id),
278278
0,0,0);
279-
if (!HeapTupleIsValid(htup))
279+
if (HeapTupleIsValid(htup))
280+
{
281+
strncat(p,
282+
NameStr(((Form_pg_shadow)GETSTRUCT(htup))->usename),
283+
NAMEDATALEN);
284+
ReleaseSysCache(htup);
285+
}
286+
else
280287
{
281288
/* Generate numeric UID if we don't find an entry */
282289
char*tmp;
@@ -286,18 +293,22 @@ aclitemout(PG_FUNCTION_ARGS)
286293
strcat(p,tmp);
287294
pfree(tmp);
288295
}
289-
else
290-
{
291-
strncat(p, (char*)&((Form_pg_shadow)
292-
GETSTRUCT(htup))->usename,
293-
sizeof(NameData));
294-
ReleaseSysCache(htup);
295-
}
296296
break;
297297
caseACL_IDTYPE_GID:
298298
strcat(p,"group ");
299299
tmpname=get_groname(aip->ai_id);
300-
strncat(p,tmpname,NAMEDATALEN);
300+
if (tmpname!=NULL)
301+
strncat(p,tmpname,NAMEDATALEN);
302+
else
303+
{
304+
/* Generate numeric GID if we don't find an entry */
305+
char*tmp;
306+
307+
tmp=DatumGetCString(DirectFunctionCall1(int4out,
308+
Int32GetDatum((int32)aip->ai_id)));
309+
strcat(p,tmp);
310+
pfree(tmp);
311+
}
301312
break;
302313
caseACL_IDTYPE_WORLD:
303314
break;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp