Gentoo Archives: gentoo-commits

From: "Robin H. Johnson (robbat2)" <robbat2@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in net-mail/vpopmail/files: vpopmail-vpgsql.patch
Date: Fri, 31 May 2013 00:32:17
Message-Id: 20130531003209.D387620081@flycatcher.gentoo.org
1 robbat2 13/05/31 00:32:09
2
3 Added: vpopmail-vpgsql.patch
4 Log:
5 Bug #277764: fix parallel install. Bug #377939: postgres support. Bug #437640: *bsd support.
6
7 (Portage version: 2.2.0_alpha177/cvs/Linux x86_64, unsigned Manifest commit)
8
9 Revision Changes Path
10 1.1 net-mail/vpopmail/files/vpopmail-vpgsql.patch
11
12 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-mail/vpopmail/files/vpopmail-vpgsql.patch?rev=1.1&view=markup
13 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-mail/vpopmail/files/vpopmail-vpgsql.patch?rev=1.1&content-type=text/plain
14
15 Index: vpopmail-vpgsql.patch
16 ===================================================================
17 --- vpgsql.c.2 2011-02-28 18:00:45.000000000 +0100
18 +++ vpgsql.c 2011-08-06 05:46:49.959717911 +0200
19 @@ -392,10 +392,10 @@
20 #endif
21
22 #ifdef ENABLE_SQL_LOGGING
23 - qnprintf( sqlBufUpdate, SQL_BUF_SIZE,
24 + qnprintf( SqlBufUpdate, SQL_BUF_SIZE,
25 "delete from vlog where domain = '%s'", domain );
26 pgres=PQexec(pgc, SqlBufUpdate);
27 - if( !pgres || PGresultStatus(pgres)!=PGRES_COMMAND_OK) {
28 + if( !pgres || PQresultStatus(pgres)!=PGRES_COMMAND_OK) {
29 return(-1);
30 }
31 #endif
32 @@ -445,11 +445,11 @@
33 #endif
34
35 #ifdef ENABLE_SQL_LOGGING
36 - qnprintf( sqlBufUpdate, SQL_BUF_SIZE,
37 + qnprintf( SqlBufUpdate, SQL_BUF_SIZE,
38 "delete from vlog where domain = '%s' and user='%s'",
39 domain, user );
40 pgres=PQexec(pgc, SqlBufUpdate);
41 - if( !pgres || PGresultStatus(pgres)!=PGRES_COMMAND_OK) {
42 + if( !pgres || PQresultStatus(pgres)!=PGRES_COMMAND_OK) {
43 err = -1;
44 }
45 #endif
46 @@ -1555,6 +1555,64 @@
47 return valias_current->data;
48 }
49 }
50 +
51 +char *valias_select_names( char *alias, char *domain )
52 +{
53 + PGresult *pgres;
54 + int err;
55 + unsigned ntuples, ctuple;
56 + struct linklist *temp_entry = NULL;
57 +
58 + /* remove old entries as necessary */
59 + while (valias_current != NULL)
60 + valias_current = linklist_del (valias_current);
61 +
62 + if ( (err =vauth_open(0)) != 0 ) return (NULL);
63 +
64 + qnprintf( SqlBufRead, SQL_BUF_SIZE,
65 + "select distinct alias from valias where domain = '%s' order by alias", domain);
66 + if ( ! (pgres=PQexec(pgc, SqlBufRead))
67 + || PQresultStatus(pgres) != PGRES_TUPLES_OK ) {
68 + if(pgres) PQclear(pgres);
69 + vcreate_valias_table();
70 + if ( ! (pgres=PQexec(pgc, SqlBufRead))
71 + || PQresultStatus(pgres) != PGRES_TUPLES_OK ) {
72 + fprintf(stderr,"vpgsql: sql error[o]: %s\n",
73 + PQerrorMessage(pgc));
74 + if (pgres) PQclear (pgres);
75 + return(NULL);
76 + }
77 + }
78 + ntuples = PQntuples (pgres);
79 + for (ctuple = 0; ctuple < ntuples; ctuple++) {
80 + temp_entry = linklist_add (temp_entry, PQgetvalue (pgres, ctuple, 1), PQgetvalue (pgres, ctuple, 0));
81 + if (valias_current == NULL) valias_current = temp_entry;
82 + }
83 + PQclear (pgres);
84 + pgres = NULL;
85 +
86 + if (valias_current == NULL) return NULL; /* no results */
87 + else {
88 + strcpy (alias, valias_current->d2);
89 + return(valias_current->data);
90 + }
91 +}
92 +
93 +char *valias_select_names_next(char *alias)
94 +{
95 + if (valias_current == NULL) return NULL;
96 + valias_current = linklist_del (valias_current);
97 +
98 + if (valias_current == NULL) return NULL; /* no results */
99 + else {
100 + strcpy(alias, valias_current->d2);
101 + return(valias_current->data);
102 + }
103 +}
104 +
105 +void valias_select_names_end() {
106 + // not needed with PostgreSQL
107 +}
108 #endif
109
110 #ifdef ENABLE_SQL_LOGGING