* nis/ypclnt.c (__xdr_ypresp_all): Minor optimization in string

handling.  Fix typo in comment.
This commit is contained in:
Ulrich Drepper 2006-04-28 17:01:50 +00:00
parent 464c9fadaf
commit 912873399c
3 changed files with 21 additions and 7 deletions

View File

@ -1,3 +1,8 @@
2006-04-28 Ulrich Drepper <drepper@redhat.com>
* nis/ypclnt.c (__xdr_ypresp_all): Minor optimization in string
handling. Fix typo in comment.
2006-04-27 Ulrich Drepper <drepper@redhat.com> 2006-04-27 Ulrich Drepper <drepper@redhat.com>
* nscd/connections.c (restart): If we want to switch back to the * nscd/connections.c (restart): If we want to switch back to the

View File

@ -686,10 +686,10 @@ __xdr_ypresp_all (XDR *xdrs, struct ypresp_all_data *objp)
if we don't modify the length. So add an extra NUL if we don't modify the length. So add an extra NUL
character to avoid trouble with broken code. */ character to avoid trouble with broken code. */
objp->status = YP_TRUE; objp->status = YP_TRUE;
memcpy (key, resp.ypresp_all_u.val.key.keydat_val, keylen); *((char *) __mempcpy (key, resp.ypresp_all_u.val.key.keydat_val,
key[keylen] = '\0'; keylen)) = '\0';
memcpy (val, resp.ypresp_all_u.val.val.valdat_val, vallen); *((char *) __mempcpy (val, resp.ypresp_all_u.val.val.valdat_val,
val[vallen] = '\0'; vallen)) = '\0';
xdr_free ((xdrproc_t) xdr_ypresp_all, (char *) &resp); xdr_free ((xdrproc_t) xdr_ypresp_all, (char *) &resp);
if ((*objp->foreach) (objp->status, key, keylen, if ((*objp->foreach) (objp->status, key, keylen,
val, vallen, objp->data)) val, vallen, objp->data))
@ -700,7 +700,7 @@ __xdr_ypresp_all (XDR *xdrs, struct ypresp_all_data *objp)
objp->status = resp.ypresp_all_u.val.stat; objp->status = resp.ypresp_all_u.val.stat;
xdr_free ((xdrproc_t) xdr_ypresp_all, (char *) &resp); xdr_free ((xdrproc_t) xdr_ypresp_all, (char *) &resp);
/* Sun says we don't need to make this call, but must return /* Sun says we don't need to make this call, but must return
immediatly. Since Solaris makes this call, we will call immediately. Since Solaris makes this call, we will call
the callback function, too. */ the callback function, too. */
(*objp->foreach) (objp->status, NULL, 0, NULL, 0, objp->data); (*objp->foreach) (objp->status, NULL, 0, NULL, 0, objp->data);
return TRUE; return TRUE;

View File

@ -1873,14 +1873,23 @@ finish_drop_privileges (void)
error (EXIT_FAILURE, errno, _("setgroups failed")); error (EXIT_FAILURE, errno, _("setgroups failed"));
} }
if (setresgid (server_gid, server_gid, old_gid) == -1) int res;
if (paranoia)
res = setresgid (server_gid, server_gid, old_gid);
else
res = setgid (server_gid);
if (res == -1)
{ {
dbg_log (_("Failed to run nscd as user '%s'"), server_user); dbg_log (_("Failed to run nscd as user '%s'"), server_user);
perror ("setgid"); perror ("setgid");
exit (4); exit (4);
} }
if (setresuid (server_uid, server_uid, old_uid) == -1) if (paranoia)
res = setresuid (server_uid, server_uid, old_uid);
else
res = setuid (server_uid);
if (res == -1)
{ {
dbg_log (_("Failed to run nscd as user '%s'"), server_user); dbg_log (_("Failed to run nscd as user '%s'"), server_user);
perror ("setuid"); perror ("setuid");