diff options
author | Guillaume Nault <g.nault@alphalink.fr> | 2014-04-11 19:46:16 +0200 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2014-04-14 17:03:01 +0400 |
commit | cb4dd7730db546181916ca2510bea6d72a5f26dd (patch) | |
tree | 6f0cdf45a4c4b4e63d7c2ac14bdac6cfec190d6c /accel-pppd | |
parent | 918f808ecbe871f6c7ca615f296594e995b08697 (diff) | |
download | accel-ppp-cb4dd7730db546181916ca2510bea6d72a5f26dd.tar.gz accel-ppp-cb4dd7730db546181916ca2510bea6d72a5f26dd.zip |
pppd compat: don't try to rename radattr files if RADIUS isn't used
If accel-ppp is compiled with RADIUS support, but run without using it,
then pd->tmp_fname is NULL. This patch verifies that pd->tmp_fname is
valid before renaming the radattr file.
Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Diffstat (limited to 'accel-pppd')
-rw-r--r-- | accel-pppd/extra/pppd_compat.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/accel-pppd/extra/pppd_compat.c b/accel-pppd/extra/pppd_compat.c index 85fc02e8..7bdf5974 100644 --- a/accel-pppd/extra/pppd_compat.c +++ b/accel-pppd/extra/pppd_compat.c @@ -140,25 +140,24 @@ static void ev_ses_pre_up(struct ap_session *ses) if (!pd) return; - + #ifdef RADIUS - { - char *fname = _malloc(PATH_MAX); - if (!fname) { - log_emerg("pppd_compat: out of memory\n"); - return; - } - - sprintf(fname, "%s.%s", conf_radattr_prefix, ses->ifname); + if (pd->tmp_fname) { + char *fname = _malloc(PATH_MAX); - rename(pd->tmp_fname, fname); - - _free(fname); - _free(pd->tmp_fname); - pd->tmp_fname = NULL; + if (!fname) { + log_emerg("pppd_compat: out of memory\n"); + return; + } + + sprintf(fname, "%s.%s", conf_radattr_prefix, ses->ifname); + rename(pd->tmp_fname, fname); + + _free(fname); + _free(pd->tmp_fname); + pd->tmp_fname = NULL; } #endif - if (ses->ipv4) { pd->ipv4_addr = ses->ipv4->addr; |