9
9
* Dec 17, 1997 - Todd A. Brandys
10
10
*Orignal Version Completed.
11
11
*
12
- * $Id: crypt.c,v 1.28 2000/07/12 22:58:59 petere Exp $
12
+ * $Id: crypt.c,v 1.29 2000/08/27 21:50:18 tgl Exp $
13
13
*
14
14
*-------------------------------------------------------------------------
15
15
*/
16
16
17
+ #include <errno.h>
17
18
#include <unistd.h>
18
19
19
20
#include "postgres.h"
@@ -32,11 +33,10 @@ intpwd_cache_count = 0;
32
33
/*-------------------------------------------------------------------------*/
33
34
34
35
char *
35
- crypt_getpwdfilename ()
36
+ crypt_getpwdfilename (void )
36
37
{
37
-
38
- static char * pfnam = NULL ;
39
38
int bufsize ;
39
+ char * pfnam ;
40
40
41
41
bufsize = strlen (DataDir )+ 8 + strlen (CRYPT_PWD_FILE )+ 1 ;
42
42
pfnam = (char * )palloc (bufsize );
@@ -48,12 +48,11 @@ crypt_getpwdfilename()
48
48
/*-------------------------------------------------------------------------*/
49
49
50
50
char *
51
- crypt_getpwdreloadfilename ()
51
+ crypt_getpwdreloadfilename (void )
52
52
{
53
-
54
- static char * rpfnam = NULL ;
55
53
char * pwdfilename ;
56
54
int bufsize ;
55
+ char * rpfnam ;
57
56
58
57
pwdfilename = crypt_getpwdfilename ();
59
58
bufsize = strlen (pwdfilename )+ strlen (CRYPT_PWD_RELOAD_SUFX )+ 1 ;
@@ -65,23 +64,25 @@ crypt_getpwdreloadfilename()
65
64
66
65
/*-------------------------------------------------------------------------*/
67
66
68
- static
69
- FILE *
70
- crypt_openpwdfile ()
67
+ static FILE *
68
+ crypt_openpwdfile (void )
71
69
{
72
70
char * filename ;
73
71
FILE * pwdfile ;
74
72
75
73
filename = crypt_getpwdfilename ();
76
74
pwdfile = AllocateFile (filename ,PG_BINARY_R );
77
75
76
+ if (pwdfile == NULL )
77
+ fprintf (stderr ,"Couldn't read %s: %s\n" ,
78
+ filename ,strerror (errno ));
79
+
78
80
return pwdfile ;
79
81
}
80
82
81
83
/*-------------------------------------------------------------------------*/
82
84
83
- static
84
- int
85
+ static int
85
86
compar_user (const void * user_a ,const void * user_b )
86
87
{
87
88
@@ -115,9 +116,8 @@ compar_user(const void *user_a, const void *user_b)
115
116
116
117
/*-------------------------------------------------------------------------*/
117
118
118
- static
119
- void
120
- crypt_loadpwdfile ()
119
+ static void
120
+ crypt_loadpwdfile (void )
121
121
{
122
122
123
123
char * filename ;
@@ -176,8 +176,7 @@ crypt_loadpwdfile()
176
176
177
177
/*-------------------------------------------------------------------------*/
178
178
179
- static
180
- void
179
+ static void
181
180
crypt_parsepwdentry (char * buffer ,char * * pwd ,char * * valdate )
182
181
{
183
182
@@ -212,11 +211,9 @@ crypt_parsepwdentry(char *buffer, char **pwd, char **valdate)
212
211
213
212
/*-------------------------------------------------------------------------*/
214
213
215
- static
216
- int
214
+ static int
217
215
crypt_getloginfo (const char * user ,char * * passwd ,char * * valuntil )
218
216
{
219
-
220
217
char * pwd ,
221
218
* valdate ;
222
219
void * fakeout ;