/*
-** Copyright 2000-2008 Double Precision, Inc. See COPYING for
+** Copyright 2000-2018 Double Precision, Inc. See COPYING for
** distribution information.
*/
#include "authdaemonrc.h"
#include "courierauthdebug.h"
#include "pkglibdir.h"
+#include "courierauth.h"
#include "courierauthstaticlist.h"
#include "libhmac/hmac.h"
-#include "cramlib.h"
#include <ltdl.h>
strcat(skun.sun_path, ".tmp");
unlink(skun.sun_path);
if (bind(fd, (const struct sockaddr *)&skun, sizeof(skun)) ||
- listen(fd, SOMAXCONN) ||
- chmod(skun.sun_path, 0777) ||
- rename(skun.sun_path, AUTHDAEMONSOCK) ||
- fcntl(fd, F_SETFL, O_NONBLOCK) < 0)
+ listen(fd, SOMAXCONN) ||
+ chmod(skun.sun_path, 0777) ||
+ rename(skun.sun_path, AUTHDAEMONSOCK) ||
+ fcntl(fd, F_SETFD, FD_CLOEXEC) < 0 ||
+ fcntl(fd, F_SETFL, O_NONBLOCK) < 0)
{
perror(AUTHDAEMONSOCK);
close(fd);
return (1);
if (authinfo->fullname)
{
- /*
- * Only the first field of the comma-seperated GECOS field is the
- * full username.
+ /*
+ * Only the first field of the comma-seperated GECOS field is the
+ * full username.
*/
char *fullname;
char *p;
p = fullname;
while (*p != ',' && *p != '\0')
p++;
- *p=0;
+ *p=0;
retval = writeenvval(fd, "NAME", fullname);
free(fullname);
if(retval)
struct authstaticinfolist *l;
ei.fd=fd;
+ ei.buf_ptr=ei.buffer;
ei.buf_left=0;
for (l=modulelist; l; l=l->next)
saddr_len=sizeof(saddr);
if ((fd=accept(s, &saddr, &saddr_len)) < 0)
continue;
- if (fcntl(fd, F_SETFL, 0) < 0)
+ if (fcntl(fd, F_SETFL, 0) < 0 ||
+ fcntl(fd, F_SETFD, FD_CLOEXEC) < 0)
{
perror("CRIT: fcntl() failed");
}
close(fd);
}
}
-
-int main(int argc, char **argv)
-{
- courier_authdebug_login_init();
-
- if (argc > 1)
- {
- fprintf(stderr, "Error: authdaemond no longer handles its own daemonizing.\n"
- "Use new startup script.\n");
- exit(1);
- }
-
- start();
- return (0);
-}