OSSP CVS Repository

ossp - Difference in ossp-pkg/l2/l2_ch_syslog.c versions 1.21 and 1.22
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/l2/l2_ch_syslog.c 1.21 -> 1.22

--- l2_ch_syslog.c       2001/09/14 19:11:00     1.21
+++ l2_ch_syslog.c       2001/10/06 14:33:09     1.22
@@ -220,17 +220,23 @@
         /* open remote syslog connection via UDP socket */
         if (cfg->szRemoteHost == NULL)
             return L2_ERR_USE;
-        if ((rc = sa_u2a(&cfg->saaRemoteAddr, "udp://%s:%d", 
-                         cfg->szRemoteHost, cfg->nRemotePort)) != SA_OK)
+        if ((rc = sa_addr_create(&cfg->saaRemoteAddr)) != SA_OK)
+            return (rc == SA_ERR_SYS ? L2_ERR_SYS : L2_ERR_INT);
+        if ((rc = sa_addr_u2a(cfg->saaRemoteAddr, "inet://%s:%d", 
+                              cfg->szRemoteHost, cfg->nRemotePort)) != SA_OK)
             return (rc == SA_ERR_SYS ? L2_ERR_SYS : L2_ERR_INT);
         if ((rc = sa_create(&cfg->saRemoteSock)) != SA_OK)
             return (rc == SA_ERR_SYS ? L2_ERR_SYS : L2_ERR_INT);
+        sa_type(cfg->saRemoteSock, SA_TYPE_DATAGRAM);
         sa_timeout(cfg->saRemoteSock, 10, 0);
+        if ((rc = sa_addr_create(&la)) != SA_OK)
+            return (rc == SA_ERR_SYS ? L2_ERR_SYS : L2_ERR_INT);
         /* FIXME: if uid == 0 -> use port 514 */
-        if ((rc = sa_u2a(&la, "udp://0.0.0.0:0")) != SA_OK)
+        if ((rc = sa_addr_u2a(la, "inet://0.0.0.0:0")) != SA_OK)
             return (rc == SA_ERR_SYS ? L2_ERR_SYS : L2_ERR_INT);
         if ((rc = sa_bind(cfg->saRemoteSock, la)) != SA_OK)
             return (rc == SA_ERR_SYS ? L2_ERR_SYS : L2_ERR_INT);
+        sa_addr_destroy(la);
     }
     return L2_OK;
 }
@@ -286,8 +292,8 @@
                     cfg->szIdent, buf);
         if ((n = strlen(caBuf)) > 1024)
             return L2_ERR_IO;
-        if ((rc = sa_writeto(cfg->saRemoteSock, caBuf, n, 
-                             NULL, cfg->saaRemoteAddr)) != SA_OK)
+        if ((rc = sa_send(cfg->saRemoteSock, caBuf, n, 
+                          NULL, cfg->saaRemoteAddr)) != SA_OK)
             return (rc == SA_ERR_SYS ? L2_ERR_SYS : L2_ERR_IO);
     }
 
@@ -308,7 +314,7 @@
             cfg->saRemoteSock = NULL;
         }
         if (cfg->saaRemoteAddr != NULL) {
-            free(cfg->saaRemoteAddr);
+            sa_addr_destroy(cfg->saaRemoteAddr);
             cfg->saaRemoteAddr = NULL;
         }
     }
@@ -334,7 +340,7 @@
     if (cfg->saRemoteSock != NULL)
         sa_destroy(cfg->saRemoteSock);
     if (cfg->saaRemoteAddr != NULL)
-        free(cfg->saaRemoteAddr);
+        sa_addr_destroy(cfg->saaRemoteAddr);
     free(cfg);
 
     return L2_OK;

CVSTrac 2.0.1