X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=pppd%2Fauth.c;h=590a265eda7b3cb646493d8fbc812a5a3ed25162;hb=f6330ec2a89df650cd6bfeaa6538b8053aeb45c7;hp=4271af687102dc62e3c2e3b47d3fc8ab1d70d0f8;hpb=225361d64ae737afdc8cb57579a2f33525461bc9;p=ppp.git diff --git a/pppd/auth.c b/pppd/auth.c index 4271af6..590a265 100644 --- a/pppd/auth.c +++ b/pppd/auth.c @@ -100,6 +100,10 @@ #endif #include +#ifdef SYSTEMD +#include +#endif + #include "pppd.h" #include "fsm.h" #include "lcp.h" @@ -426,6 +430,7 @@ setupapfile(argv) euid = geteuid(); if (seteuid(getuid()) == -1) { option_error("unable to reset uid before opening %s: %m", fname); + free(fname); return 0; } ufile = fopen(fname, "r"); @@ -433,6 +438,7 @@ setupapfile(argv) fatal("unable to regain privileges: %m"); if (ufile == NULL) { option_error("unable to open user login data file %s", fname); + free(fname); return 0; } check_access(ufile, fname); @@ -443,6 +449,7 @@ setupapfile(argv) || fgets(p, MAXSECRETLEN - 1, ufile) == NULL) { fclose(ufile); option_error("unable to read user login data file %s", fname); + free(fname); return 0; } fclose(ufile); @@ -464,6 +471,7 @@ setupapfile(argv) explicit_passwd = 1; } + free(fname); return (1); } @@ -1099,8 +1107,15 @@ np_up(unit, proto) /* * Detach now, if the updetach option was given. */ - if (updetach && !nodetach) + if (updetach && !nodetach) { + dbglog("updetach is set. Now detaching."); detach(); +#ifdef SYSTEMD + } else if (nodetach && up_sdnotify) { + dbglog("up_sdnotify is set. Now notifying systemd: READY=1"); + sd_notify(0, "READY=1"); +#endif + } } ++num_np_up; }