diff options
-rw-r--r-- | src/ChangeLog | 7 | ||||
-rw-r--r-- | src/assuan-connect.c | 6 | ||||
-rw-r--r-- | src/assuan-defs.h | 10 |
3 files changed, 18 insertions, 5 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 8879186..9911d55 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2007-07-08 Marcus Brinkmann <[email protected]> + + * assuan-defs.h (struct assuan_context_s): Have full peercred + structure for HAVE_SO_PEERCRED. + * assuan-connect.c (assuan_get_peercred) [!HAVE_SO_PEERCRED]: Do + not try to set PID, UID and GID. + 2007-07-05 Werner Koch <[email protected]> * assuan-defs.h (struct assuan_context_s): Have peercred.valid diff --git a/src/assuan-connect.c b/src/assuan-connect.c index eba65d2..7328ec4 100644 --- a/src/assuan-connect.c +++ b/src/assuan-connect.c @@ -57,10 +57,10 @@ assuan_get_pid (assuan_context_t ctx) } +#ifndef HAVE_W32_SYSTEM /* Return user credentials. PID, UID and GID amy be gived as NULL if you are not interested in this value. For getting the pid of the peer the assuan_get_pid is usually better suited. */ -#ifndef HAVE_W32_SYSTEM assuan_error_t assuan_get_peercred (assuan_context_t ctx, pid_t *pid, uid_t *uid, gid_t *gid) { @@ -68,12 +68,16 @@ assuan_get_peercred (assuan_context_t ctx, pid_t *pid, uid_t *uid, gid_t *gid) return _assuan_error (ASSUAN_Invalid_Value); if (!ctx->peercred.valid) return _assuan_error (ASSUAN_General_Error); + +#ifdef HAVE_SO_PEERCRED if (pid) *pid = ctx->peercred.pid; if (uid) *uid = ctx->peercred.uid; if (gid) *gid = ctx->peercred.gid; +#endif + return 0; } #endif /* HAVE_W32_SYSTEM */ diff --git a/src/assuan-defs.h b/src/assuan-defs.h index 9ee230d..b1d9f3e 100644 --- a/src/assuan-defs.h +++ b/src/assuan-defs.h @@ -5,7 +5,7 @@ * * Assuan is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 3 of + * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * Assuan is distributed in the hope that it will be useful, but @@ -14,7 +14,9 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, see <http://www.gnu.org/licenses/>. + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. */ #ifndef ASSUAN_DEFS_H @@ -140,11 +142,11 @@ struct assuan_context_s struct { int valid; /* Whether this structure has valid information. */ -#ifndef HAVE_W32_SYSTEM +#ifdef HAVE_SO_PEERCRED pid_t pid; /* The pid of the peer. */ uid_t uid; /* The uid of the peer. */ gid_t gid; /* The gid of the peer. */ -#endif /* HAVE_W32_SYSTEM */ +#endif /* HAVE_SO_PEERCRED */ } peercred; /* Used for Unix domain sockets. */ |