]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/plugins/radius/avpair.c
config: Include some extra files in the tarball
[ppp.git] / pppd / plugins / radius / avpair.c
index 0dc9a85d13a6be0b4e8e939961e754e5a7ce2b00..5ad1cc902040b84c63528ea2eccc5600e079c876 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * $Id: avpair.c,v 1.1 2004/11/14 07:26:26 paulus Exp $
- *
  * Copyright (C) 1995 Lars Fenneberg
  *
  * Copyright 1992 Livingston Enterprises, Inc.
@@ -31,7 +29,7 @@ static void rc_extract_vendor_specific_attributes(int attrlen,
  *
  */
 
-VALUE_PAIR *rc_avpair_add (VALUE_PAIR **list, int attrid, void *pval, int len,
+VALUE_PAIR *rc_avpair_add (VALUE_PAIR **list, int attrid, const void *pval, int len,
                           int vendorcode)
 {
        VALUE_PAIR     *vp;
@@ -57,7 +55,7 @@ VALUE_PAIR *rc_avpair_add (VALUE_PAIR **list, int attrid, void *pval, int len,
  *
  */
 
-int rc_avpair_assign (VALUE_PAIR *vp, void *pval, int len)
+int rc_avpair_assign (VALUE_PAIR *vp, const void *pval, int len)
 {
        int     result = -1;
 
@@ -65,19 +63,19 @@ int rc_avpair_assign (VALUE_PAIR *vp, void *pval, int len)
        {
                case PW_TYPE_STRING:
 
-                       if (((len == 0) && (strlen ((char *) pval)) > AUTH_STRING_LEN)
+                       if (((len == 0) && (strlen ((const char *) pval)) > AUTH_STRING_LEN)
                            || (len > AUTH_STRING_LEN)) {
                                error("rc_avpair_assign: bad attribute length");
                                return result;
                    }
 
                        if (len > 0) {
-                               memcpy(vp->strvalue, (char *)pval, len);
+                               memcpy(vp->strvalue, (const char *)pval, len);
                                vp->strvalue[len] = '\0';
                                vp->lvalue = len;
                        } else {
-                       strncpy ((char*) vp->strvalue, (char *) pval, AUTH_STRING_LEN);
-                       vp->lvalue = strlen((char *) pval);
+                       strncpy ((char*) vp->strvalue, (const char *) pval, AUTH_STRING_LEN);
+                       vp->lvalue = strlen((const char *) pval);
                        }
 
                        result = 0;
@@ -107,7 +105,7 @@ int rc_avpair_assign (VALUE_PAIR *vp, void *pval, int len)
  *
  */
 
-VALUE_PAIR *rc_avpair_new (int attrid, void *pval, int len, int vendorcode)
+VALUE_PAIR *rc_avpair_new (int attrid, const void *pval, int len, int vendorcode)
 {
        VALUE_PAIR     *vp = (VALUE_PAIR *) NULL;
        DICT_ATTR      *pda;
@@ -426,7 +424,7 @@ void rc_avpair_insert (VALUE_PAIR **a, VALUE_PAIR *p, VALUE_PAIR *b)
        else /* look for the "p" entry in the "a" list (or run to end) */
        {
                this_node = *a;
-               while (this_node != (VALUE_PAIR *) NULL)
+               while (this_node->next != (VALUE_PAIR *) NULL)
                {
                        if (this_node == p)
                        {
@@ -699,6 +697,7 @@ int rc_avpair_tostr (VALUE_PAIR *pair, char *name, int ln, char *value, int lv)
        struct in_addr  inad;
        unsigned char         *ptr;
        char            *str;
+       time_t tmptime;
 
        *name = *value = '\0';
 
@@ -752,8 +751,9 @@ int rc_avpair_tostr (VALUE_PAIR *pair, char *name, int ln, char *value, int lv)
                break;
 
            case PW_TYPE_DATE:
+               tmptime = pair->lvalue;
                strftime (buffer, sizeof (buffer), "%m/%d/%y %H:%M:%S",
-                         gmtime ((time_t *) & pair->lvalue));
+                         gmtime (&tmptime));
                strncpy(value, buffer, lv-1);
                break;