Hi,

The small patch below fixes two DA log issues:
- a 'removed' DA was logged with a bogus IP address
- an empty attribute list was shown as '<invalid data!>'

A similar patch was already sent about a year ago for openSLP 1.2. This patch 
is against trunk/r1589.

Kind regards,
   Roel van de Kraats


--- begin patch ---

Fix a small problem where SLPDLogDAAdvertisement() was called for a 'removed' 
DA after
the entry was removed (causing a bogus IP address to be logged).
Also keep the difference between null strings and strings with length zero in 
parsing messages.
Roel van de Kraats

diff -ur openslp-2.0.beta1.r1589/common/slp_message.c 
openslp-2.0.beta1.dalog/common/slp_message.c
--- openslp-2.0.beta1.r1589/common/slp_message.c 2008-03-27 03:26:34.000000000 
+0100
+++ openslp-2.0.beta1.dalog/common/slp_message.c      2008-06-26 
17:45:43.000000000 +0200
@@ -104,11 +104,11 @@
  *
  * @return A pointer to the first character at the address pointed to by 
  *    @p cppstring pointer; the buffer pointer is moved ahead by @p len bytes
- *    on return. If @p len is zero, returns NULL.
+ *    on return.
  */
 char * GetStrPtr(uint8_t ** cpp, size_t len)
 {
-   char * sp = len? (char *)*cpp: 0;
+   char * sp = (char *)*cpp;
    *cpp += len;
    return sp;
 }
diff -aur openslp-2.0.beta1.r1589/slpd/slpd_knownda.c 
openslp-2.0.beta1.dalog/slpd/slpd_knownda.c
--- openslp-2.0.beta1.r1589/slpd/slpd_knownda.c 2008-06-26 13:47:24.000000000 
+0200
+++ openslp-2.0.beta1.dalog/slpd/slpd_knownda.c 2008-06-26 16:02:51.000000000 
+0200
@@ -850,9 +850,18 @@
                && daadvert->bootstamp != entrydaadvert->bootstamp)
          {
             /* Advertising DA must have went down then came back up */
+            SLPDLogDAAdvertisement("Replaced", entry);
             SLPDKnownDARegisterAll(msg, 0);
          }
 
+         if ( daadvert->bootstamp == 0 )
+         {
+            /* Dying DA was found in our KnownDA database. Log that it
+             * was removed.
+             */
+            SLPDLogDAAdvertisement("Removed", entry);
+         }
+
          /* Remove the entry that is the same as the advertised entry */
          /* so that we can put the new advertised entry back in       */
          SLPDatabaseRemove(dh, entry);
@@ -905,17 +914,6 @@
 
       return result;
    }
-   else
-   {
-      /* DA is dying */
-      if (entry)
-      {
-         /* Dying DA was found in our KnownDA database. Log that it
-          * was removed.
-          */
-         SLPDLogDAAdvertisement("Removed", entry);
-      }
-   }
 
    CLEANUP:
    /* If we are here, we need to cleanup the message descriptor and the  */



-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Openslp-devel mailing list
Openslp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openslp-devel

Reply via email to