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

Commitf988edb

Browse files
committed
Add OpenBSD local indent credentials, from William Ahern.
1 parent31504cc commitf988edb

File tree

4 files changed

+36
-7
lines changed

4 files changed

+36
-7
lines changed

‎configure

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9819,7 +9819,8 @@ test $ac_cv_func_memcmp_working = no && LIBOBJS="$LIBOBJS memcmp.$ac_objext"
98199819
98209820
98219821
9822-
forac_funcin cbrt fcvt getopt_long memmove pstat setproctitle setsid sigprocmask sysconf waitpid dlopen fdatasync
9822+
9823+
forac_funcin cbrt fcvt getopt_long getpeereid memmove pstat setproctitle setsid sigprocmask sysconf waitpid dlopen fdatasync
98239824
do
98249825
as_ac_var=`echo"ac_cv_func_$ac_func"|$as_tr_sh`
98259826
echo"$as_me:$LINENO: checking for$ac_func">&5

‎configure.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
dnl Process this file with autoconf to produce a configure script.
2-
dnl $Header: /cvsroot/pgsql/configure.in,v 1.218 2002/11/04 21:36:13 tgl Exp $
2+
dnl $Header: /cvsroot/pgsql/configure.in,v 1.219 2002/12/03 21:50:43 momjian Exp $
33
dnl
44
dnl Developers, please strive to achieve this order:
55
dnl
@@ -782,7 +782,7 @@ PGAC_FUNC_GETTIMEOFDAY_1ARG
782782
# SunOS doesn't handle negative byte comparisons properly with +/- return
783783
AC_FUNC_MEMCMP
784784

785-
AC_CHECK_FUNCS([cbrt fcvt getopt_long memmove pstat setproctitle setsid sigprocmask sysconf waitpid dlopen fdatasync])
785+
AC_CHECK_FUNCS([cbrt fcvt getopt_longgetpeereidmemmove pstat setproctitle setsid sigprocmask sysconf waitpid dlopen fdatasync])
786786

787787
AC_CHECK_DECLS(fdatasync, [], [], [#include <unistd.h>])
788788

‎doc/src/sgml/client-auth.sgml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/client-auth.sgml,v 1.41 2002/11/15 03:11:15 momjian Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/client-auth.sgml,v 1.42 2002/12/03 21:50:44 momjian Exp $
33
-->
44

55
<chapter id="client-authentication">
@@ -318,7 +318,8 @@ hostssl <replaceable>database</replaceable> <replaceable>user</replaceable> <
318318
support Unix-domain socket credentials (currently
319319
<systemitem class=osname>Linux</>, <systemitem
320320
class=osname>FreeBSD</>, <systemitem class=osname>NetBSD</>,
321-
and <systemitem class=osname>BSD/OS</>).
321+
<systemitem class=osname>OpenBSD</>, and
322+
<systemitem class=osname>BSD/OS</>).
322323
</para>
323324

324325
<para>

‎src/backend/libpq/hba.c

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $Header: /cvsroot/pgsql/src/backend/libpq/hba.c,v 1.87 2002/09/04 20:31:19 momjian Exp $
13+
* $Header: /cvsroot/pgsql/src/backend/libpq/hba.c,v 1.88 2002/12/03 21:50:44 momjian Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -1216,7 +1216,34 @@ ident_inet(const struct in_addr remote_ip_addr,
12161216
staticbool
12171217
ident_unix(intsock,char*ident_user)
12181218
{
1219-
#if defined(SO_PEERCRED)
1219+
#if defined(HAVE_GETPEEREID)
1220+
/* OpenBSD style: */
1221+
uid_tuid;
1222+
gid_tgid;
1223+
structpasswd*pass;
1224+
1225+
errno=0;
1226+
if (getpeereid(sock,&uid,&gid)!=0)
1227+
{
1228+
/* We didn't get a valid credentials struct. */
1229+
elog(LOG,"ident_unix: error receiving credentials: %m");
1230+
return false;
1231+
}
1232+
1233+
pass=getpwuid(uid);
1234+
1235+
if (pass==NULL)
1236+
{
1237+
elog(LOG,"ident_unix: unknown local user with uid %d",
1238+
(int)uid);
1239+
return false;
1240+
}
1241+
1242+
StrNCpy(ident_user,pass->pw_name,IDENT_USERNAME_MAX+1);
1243+
1244+
return true;
1245+
1246+
#elsif defined(SO_PEERCRED)
12201247
/* Linux style: use getsockopt(SO_PEERCRED) */
12211248
structucredpeercred;
12221249
ACCEPT_TYPE_ARG3so_len=sizeof(peercred);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp