summaryrefslogtreecommitdiff
path: root/databases/nss-pgsql/patches/patch-src_backend.c
blob: 667a1483344ec4e74135199eb6632198794e576b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# $NetBSD: patch-src_backend.c,v 1.1.1.1 2013/03/17 14:12:02 asau Exp $

Changes name of libpq-fe.h so it works on our PostgreSQL installation
Reorders list of copy_attr_colname as it references copy_attr_string

--- src/backend.c.orig	2008-08-19 09:44:37.000000000 +0000
+++ src/backend.c
@@ -11,7 +11,7 @@
  */
 
 #include "nss-pgsql.h"
-#include <postgresql/libpq-fe.h>
+#include <libpq-fe.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
@@ -205,22 +205,6 @@ inline void getent_close(char type)
   Assign a single value to *valptr from the specified row in the result
 */
 enum nss_status
-copy_attr_colnum(PGresult *res, int attrib_number, char **valptr,
-                 char **buffer, size_t *buflen, int *errnop, int row)
-{
-
-	const char *sptr;
-	size_t slen;
-
-	sptr = PQgetvalue(res, row, attrib_number);
-	return copy_attr_string(sptr, valptr, buffer, buflen, errnop);
-}
-
-/*
-  With apologies to nss_ldap...
-  Assign a single value to *valptr from the specified row in the result
-*/
-enum nss_status
 copy_attr_string(char *sptr, char **valptr,
                  char **buffer, size_t *buflen, int *errnop)
 {
@@ -244,6 +228,22 @@ copy_attr_string(char *sptr, char **valp
 }
 
 /*
+  With apologies to nss_ldap...
+  Assign a single value to *valptr from the specified row in the result
+*/
+enum nss_status
+copy_attr_colnum(PGresult *res, int attrib_number, char **valptr,
+                 char **buffer, size_t *buflen, int *errnop, int row)
+{
+
+	const char *sptr;
+	size_t slen;
+
+	sptr = PQgetvalue(res, row, attrib_number);
+	return copy_attr_string(sptr, valptr, buffer, buflen, errnop);
+}
+
+/*
  * return array of strings containing usernames that are member of group with gid 'gid'
  */
 enum nss_status getgroupmem(gid_t gid,
@@ -778,6 +778,7 @@ size_t backend_initgroups_dyn(const char
 	return *start;
 }
 
+#ifdef HAVE_SHADOW_H
 /*
  * 'convert' a PGresult to struct shadow
  */
@@ -863,4 +864,4 @@ enum nss_status backend_getspnam(const c
     
 	return status;
 }
-
+#endif