summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--auth.c41
-rw-r--r--session.c33
-rw-r--r--socket.c7
3 files changed, 50 insertions, 31 deletions
diff --git a/auth.c b/auth.c
index d0ec294..38191f8 100644
--- a/auth.c
+++ b/auth.c
@@ -865,7 +865,8 @@ DefineSelf (int fd, FILE *file, Xauth *auth)
int len, ipfd;
if ((ipfd = open ("/dev/ip", O_RDWR, 0 )) < 0)
- LogError ("Getting interface configuration");
+ LogError ("cannot get interface configuration; cannot open /dev/ip: "
+ "%s\n", _SysErrorMsg (errno));
/* Indicate that we want to start at the begining */
ifnet.ib_next = (struct ipb *) 1;
@@ -879,8 +880,9 @@ DefineSelf (int fd, FILE *file, Xauth *auth)
if (ioctl (ipfd, (int) I_STR, (char *) &str) < 0)
{
+ LogError ("cannot get interface configuration; ioctl failed: %s\n",
+ _SysErrorMsg (errno));
close (ipfd);
- LogError ("Getting interface configuration");
}
ifaddr.ia_next = (struct in_ifaddr *) ifnet.if_addrlist;
@@ -891,8 +893,9 @@ DefineSelf (int fd, FILE *file, Xauth *auth)
if (ioctl (ipfd, (int) I_STR, (char *) &str) < 0)
{
+ LogError ("cannot get interface configuration; ioctl failed: %s\n",
+ _SysErrorMsg (errno));
close (ipfd);
- LogError ("Getting interface configuration");
}
/*
@@ -1350,16 +1353,22 @@ SetUserAuthorization (struct display *d, struct verify_info *verify)
doneAddrs ();
fclose (new);
if (unlink (name) == -1)
- Debug ("unlink %s failed\n", name);
+ if (errno != ENOENT)
+ LogError ("cannot remove old authorization file %s: %s\n",
+ name, _SysErrorMsg (errno));
envname = name;
if (link (new_name, name) == -1) {
- Debug ("link failed %s %s\n", new_name, name);
- LogError ("Can't move authorization into place\n");
+ LogError ("cannot link temporary authorization file %s to old "
+ "location %s: %s\n", new_name, name,
+ _SysErrorMsg (errno));
setenv = 1;
envname = new_name;
} else {
- Debug ("new is in place, go for it!\n");
- unlink (new_name);
+ Debug ("authorization file %s successfully updated\n", name);
+ if (unlink (new_name))
+ if (errno != ENOENT)
+ LogError ("cannot remove new authorization file %s:"
+ " %s\n", new_name, _SysErrorMsg (errno));
}
if (setenv) {
verify->userEnviron = setEnv (verify->userEnviron,
@@ -1429,13 +1438,19 @@ RemoveUserAuthorization (struct display *d, struct verify_info *verify)
doneAddrs ();
fclose (new);
if (unlink (name) == -1)
- Debug ("unlink %s failed\n", name);
+ if (errno != ENOENT)
+ LogError ("cannot remove new authorization file %s: %s\n",
+ name, _SysErrorMsg (errno));
if (link (new_name, name) == -1) {
- Debug ("link failed %s %s\n", new_name, name);
- LogError ("Can't move authorization into place\n");
+ LogError ("cannot link temporary authorization file %s to old "
+ "location %s: %s\n", new_name, name,
+ _SysErrorMsg (errno));
} else {
- Debug ("new is in place, go for it!\n");
- unlink (new_name);
+ Debug ("authorization file %s successfully updated\n", name);
+ if (unlink (new_name))
+ if (errno != ENOENT)
+ LogError ("cannot remove new authorization file %s:"
+ " %s\n", new_name, _SysErrorMsg (errno));
}
}
XauUnlockAuth (name);
diff --git a/session.c b/session.c
index b2c9294..5040d3b 100644
--- a/session.c
+++ b/session.c
@@ -607,20 +607,22 @@ StartClient (
#ifndef AIXV3
# ifndef HAS_SETUSERCONTEXT
- if (setgid(verify->gid) < 0) {
- LogError ("setgid %d (user \"%s\") failed, errno=%d\n",
- verify->gid, name, errno);
+ if (setgid (verify->gid) < 0) {
+ LogError ("setgid %d (user \"%s\") failed: %s\n",
+ verify->gid, name, _SysErrorMsg (errno));
return (0);
}
# if defined(BSD) && (BSD >= 199103)
- if (setlogin(name) < 0) {
- LogError ("setlogin for \"%s\" failed, errno=%d", name, errno);
- return(0);
+ if (setlogin (name) < 0) {
+ LogError ("setlogin for \"%s\" failed: %s\n",
+ name, _SysErrorMsg (errno));
+ return (0);
}
# endif
# ifndef QNX4
- if (initgroups(name, verify->gid) < 0) {
- LogError ("initgroups for \"%s\" failed, errno=%d\n", name, errno);
+ if (initgroups (name, verify->gid) < 0) {
+ LogError ("initgroups for \"%s\" failed: %s\n",
+ name, _SysErrorMsg (errno));
return (0);
}
# endif /* QNX4 doesn't support multi-groups, no initgroups() */
@@ -649,8 +651,8 @@ StartClient (
# ifndef HAS_SETUSERCONTEXT
if (setuid(verify->uid) < 0) {
- LogError ("setuid %d (user \"%s\") failed, errno=%d\n",
- verify->uid, name, errno);
+ LogError ("setuid %d (user \"%s\") failed: %s\n",
+ verify->uid, name, _SysErrorMsg (errno));
return (0);
}
# else /* HAS_SETUSERCONTEXT */
@@ -661,13 +663,14 @@ StartClient (
pwd = getpwnam(name);
if (pwd) {
if (setusercontext(NULL, pwd, pwd->pw_uid, LOGIN_SETALL) < 0) {
- LogError ("setusercontext for \"%s\" failed, errno=%d\n", name,
- errno);
+ LogError ("setusercontext for \"%s\" failed: %s\n",
+ name, _SysErrorMsg (errno));
return (0);
}
endpwent();
} else {
- LogError ("getpwnam for \"%s\" failed, errno=%d\n", name, errno);
+ LogError ("getpwnam for \"%s\" failed: %s\n",
+ name, _SysErrorMsg (errno));
return (0);
}
# endif /* HAS_SETUSERCONTEXT */
@@ -677,8 +680,8 @@ StartClient (
* audit classes, user limits, and umask.
*/
if (setpcred(name, NULL) == -1) {
- LogError ("setpcred for \"%s\" failed: %s\n", name,
- _SysErrorMsg (errno));
+ LogError ("setpcred for \"%s\" failed: %s\n",
+ name, _SysErrorMsg (errno));
return (0);
}
#endif /* AIXV3 */
diff --git a/socket.c b/socket.c
index 16d43d8..3f73ae4 100644
--- a/socket.c
+++ b/socket.c
@@ -71,7 +71,7 @@ CreateWellKnownSockets (void)
Debug ("Created chooser socket %d\n", chooserFd);
if (chooserFd == -1)
{
- LogError ("chooser socket creation failed, errno %d\n", errno);
+ LogError ("chooser socket creation failed: %s\n", _SysErrorMsg (errno));
return;
}
listen (chooserFd, 5);
@@ -149,14 +149,15 @@ CreateListeningSocket (struct sockaddr *sock_addr, int salen)
fd = socket (sock_addr->sa_family, SOCK_DGRAM, 0);
if (fd == -1) {
- LogError ("XDMCP socket creation failed, errno %d\n", errno);
+ LogError ("XDMCP socket creation failed: %s\n", _SysErrorMsg (errno));
return fd;
}
RegisterCloseOnFork (fd);
if (bind (fd, sock_addr, salen) == -1)
{
- LogError ("error %d binding socket address %d\n", errno, request_port);
+ LogError ("error binding socket address %d: %s\n", request_port,
+ _SysErrorMsg (errno));
close (fd);
fd = -1;
return fd;