mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-14 12:41:21 +00:00
2003-11-17 Hasso Tepper <hasso@estpak.ee>
* ripngd/ripngd.c: ripng_make_socket() add calls to raise/lower privs.
This commit is contained in:
parent
b5f2c1267e
commit
27d47aa7af
@ -35,6 +35,7 @@
|
|||||||
#include "plist.h"
|
#include "plist.h"
|
||||||
#include "routemap.h"
|
#include "routemap.h"
|
||||||
#include "if_rmap.h"
|
#include "if_rmap.h"
|
||||||
|
#include "privs.h"
|
||||||
|
|
||||||
#include "ripngd/ripngd.h"
|
#include "ripngd/ripngd.h"
|
||||||
#include "ripngd/ripng_route.h"
|
#include "ripngd/ripng_route.h"
|
||||||
@ -52,6 +53,8 @@ enum
|
|||||||
ripng_changed_route,
|
ripng_changed_route,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern struct zebra_privs_t ripngd_privs;
|
||||||
|
|
||||||
/* Prototypes. */
|
/* Prototypes. */
|
||||||
void
|
void
|
||||||
ripng_output_process (struct interface *, struct sockaddr_in6 *, int);
|
ripng_output_process (struct interface *, struct sockaddr_in6 *, int);
|
||||||
@ -153,12 +156,19 @@ ripng_make_socket (void)
|
|||||||
#endif /* SIN6_LEN */
|
#endif /* SIN6_LEN */
|
||||||
ripaddr.sin6_port = htons (RIPNG_PORT_DEFAULT);
|
ripaddr.sin6_port = htons (RIPNG_PORT_DEFAULT);
|
||||||
|
|
||||||
|
if (ripngd_privs.change (ZPRIVS_RAISE))
|
||||||
|
zlog_err ("ripng_make_socket: could not raise privs");
|
||||||
|
|
||||||
ret = bind (sock, (struct sockaddr *) &ripaddr, sizeof (ripaddr));
|
ret = bind (sock, (struct sockaddr *) &ripaddr, sizeof (ripaddr));
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
zlog (NULL, LOG_ERR, "Can't bind ripng socket: %s.", strerror (errno));
|
zlog (NULL, LOG_ERR, "Can't bind ripng socket: %s.", strerror (errno));
|
||||||
return ret;
|
if (ripngd_privs.change (ZPRIVS_LOWER))
|
||||||
}
|
zlog_err ("ripng_make_socket: could not lower privs");
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
if (ripngd_privs.change (ZPRIVS_LOWER))
|
||||||
|
zlog_err ("ripng_make_socket: could not lower privs");
|
||||||
return sock;
|
return sock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user