Imported Upstream version 3.3.2
[debian/amanda] / common-src / bsdudp-security.c
index cd265b3b47b5053e79c6e09bdbfce0bfab347bea..a4715ff9d9a3dd5b4683f22a9c19203474f72df8 100644 (file)
@@ -63,6 +63,7 @@ const security_driver_t bsdudp_security_driver = {
     "BSDUDP",
     bsdudp_connect,
     bsdudp_accept,
+    sec_get_authenticated_peer_name_hostname,
     bsdudp_close,
     udpbsd_sendpkt,
     udp_recvpkt,
@@ -120,7 +121,7 @@ bsdudp_connect(
     (void)datap;       /* Quiet unused parameter warning */
     assert(hostname != NULL);
 
-    bh = alloc(sizeof(*bh));
+    bh = g_new0(struct sec_handle, 1);
     bh->proto_handle=NULL;
     bh->rc = NULL;
     security_handleinit(&bh->sech, &bsdudp_security_driver);
@@ -159,10 +160,8 @@ bsdudp_connect(
         * Only init the IPv6 socket once
         */
        if (res_addr->ai_addr->sa_family == AF_INET6 && not_init6 == 1) {
-           uid_t euid;
            dgram_zero(&netfd6.dgram);
 
-           euid = geteuid();
            set_root_privs(1);
            result_bind = dgram_bind(&netfd6.dgram,
                                     res_addr->ai_addr->sa_family, &port);
@@ -201,10 +200,8 @@ bsdudp_connect(
         * Only init the IPv4 socket once
         */
        if (res_addr->ai_addr->sa_family == AF_INET && not_init4 == 1) {
-           uid_t euid;
            dgram_zero(&netfd4.dgram);
 
-           euid = geteuid();
            set_root_privs(1);
            result_bind = dgram_bind(&netfd4.dgram,
                                     res_addr->ai_addr->sa_family, &port);