X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=amandad-src%2Famandad.c;h=8d9b3d6b680133603cc551655523d55d9fde2b91;hb=e9de482962ca61612054c6e0382814b04e416129;hp=cfb7a47948ec7edeb04786fe85e9058f389a468c;hpb=2627875b7d18858bc1f9f7652811e4d8c15a23eb;p=debian%2Famanda diff --git a/amandad-src/amandad.c b/amandad-src/amandad.c index cfb7a47..8d9b3d6 100644 --- a/amandad-src/amandad.c +++ b/amandad-src/amandad.c @@ -445,12 +445,19 @@ main( if (getuid() == 0) { if (strcasecmp(auth, "krb5") != 0) { - error(_("Amanda must be run as user '%s' when using '%s' authentication"), - CLIENT_LOGIN, auth); + struct passwd *pwd; + /* lookup our local user name */ + if ((pwd = getpwnam(CLIENT_LOGIN)) == NULL) { + error(_("getpwnam(%s) failed."), CLIENT_LOGIN); + } + if (pwd->pw_uid != 0) { + error(_("'amandad' must be run as user '%s' when using '%s' authentication"), + CLIENT_LOGIN, auth); + } } } else { if (strcasecmp(auth, "krb5") == 0) { - error(_("Amanda must be run as user 'root' when using 'krb5' authentication")); + error(_("'amandad' must be run as user 'root' when using 'krb5' authentication")); } } @@ -1255,7 +1262,7 @@ errfd_recv( } /* for each line terminate by '\n' */ - while (as->errbuf != NULL && (r = index(as->errbuf, '\n')) != NULL) { + while (as->errbuf != NULL && (r = strchr(as->errbuf, '\n')) != NULL) { char *s; *r = '\0'; @@ -1670,6 +1677,21 @@ service_new( data_write[i + 1][0] = newfd; } } + while(data_write[4][0] >= DATA_FD_OFFSET && + data_write[4][0] <= DATA_FD_OFFSET + DATA_FD_COUNT*2 - 1) { + newfd = dup(data_write[4][0]); + if (newfd == -1) + error(_("Can't dup out off DATA_FD range")); + data_write[4][0] = newfd; + } + while(data_write[4][1] >= DATA_FD_OFFSET && + data_write[4][1] <= DATA_FD_OFFSET + DATA_FD_COUNT*2 - 1) { + newfd = dup(data_write[4][1]); + if (newfd == -1) + error(_("Can't dup out off DATA_FD range")); + data_write[4][1] = newfd; + } + for (i = 0; i < DATA_FD_COUNT*2; i++) close(DATA_FD_OFFSET + i);