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

Commit3d039b5

Browse files
committed
Fix build breakage on Solaris-alikes with late-model GCC.
Solaris has never bothered to add "const" to the second argumentof PAM conversation procs, as all other Unixen did decades ago.This resulted in an "incompatible pointer" compiler warning whenbuilding --with-pam, but had no more serious effect than that,so we never did anything about it. However, as of GCC 14 thecase is an error not warning by default.To complicate matters, recent OpenIndiana (and maybe illumosin general?) *does* supply the "const" by default, so we can'tjust assume that platforms using our solaris template need help.What we can do, short of building a configure-time probe,is to make solaris.h #define _PAM_LEGACY_NONCONST, whichcauses OpenIndiana's pam_appl.h to revert to the traditionaldefinition, and hopefully will have no effect anywhere else.Then we can use that same symbol to control whether we include"const" in the declaration of pam_passwd_conv_proc().Bug: #18995Reported-by: Andrew Watkins <awatkins1966@gmail.com>Author: Tom Lane <tgl@sss.pgh.pa.us>Discussion:https://postgr.es/m/18995-82058da9ab4337a7@postgresql.orgBackpatch-through: 13
1 parent7b98c55 commit3d039b5

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

‎src/backend/libpq/auth.c‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,16 @@ static intauth_peer(hbaPort *port);
9494

9595
#definePGSQL_PAM_SERVICE "postgresql"/* Service name passed to PAM */
9696

97+
/* Work around original Solaris' lack of "const" in the conv_proc signature */
98+
#ifdef_PAM_LEGACY_NONCONST
99+
#definePG_PAM_CONST
100+
#else
101+
#definePG_PAM_CONST const
102+
#endif
103+
97104
staticintCheckPAMAuth(Port*port,constchar*user,constchar*password);
98-
staticintpam_passwd_conv_proc(intnum_msg,conststructpam_message**msg,
105+
staticintpam_passwd_conv_proc(intnum_msg,
106+
PG_PAM_CONSTstructpam_message**msg,
99107
structpam_response**resp,void*appdata_ptr);
100108

101109
staticstructpam_convpam_passw_conv= {
@@ -1917,7 +1925,7 @@ auth_peer(hbaPort *port)
19171925
*/
19181926

19191927
staticint
1920-
pam_passwd_conv_proc(intnum_msg,conststructpam_message**msg,
1928+
pam_passwd_conv_proc(intnum_msg,PG_PAM_CONSTstructpam_message**msg,
19211929
structpam_response**resp,void*appdata_ptr)
19221930
{
19231931
constchar*passwd;

‎src/include/port/solaris.h‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,12 @@
2424
#if defined(__i386__)
2525
#include<sys/isa_defs.h>
2626
#endif
27+
28+
/*
29+
* On original Solaris, PAM conversation procs lack a "const" in their
30+
* declaration; but recent OpenIndiana versions put it there by default.
31+
* The least messy way to deal with this is to define _PAM_LEGACY_NONCONST,
32+
* which causes OpenIndiana to declare pam_conv per the Solaris tradition,
33+
* and also use that symbol to control omitting the "const" in our own code.
34+
*/
35+
#define_PAM_LEGACY_NONCONST 1

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp