Merge pull request #1728 from jrouzierinverse/feature/mschap-cisco
authorAlan DeKok <aland@freeradius.org>
Wed, 14 Sep 2016 15:14:38 +0000 (11:14 -0400)
committerGitHub <noreply@github.com>
Wed, 14 Sep 2016 15:14:38 +0000 (11:14 -0400)
pull NEAT fix from v4.0.x branch

doc/ChangeLog
src/lib/dict.c
src/modules/rlm_linelog/rlm_linelog.c

index f42d988..6e6a649 100644 (file)
@@ -71,6 +71,7 @@ FreeRADIUS 3.0.12 Mon 25 Jan 2016 14:00:00 EST urgency=medium
          Fixes #1684.
        * Free rad_perlconf_hv in correct perl context.
          Fixes #1675.
+       * Set OpenSSL FIPS compatibility flag when necessary.
 
 FreeRADIUS 3.0.11 Mon 25 Jan 2016 14:00:00 EST urgency=medium
        Feature improvements
index 70adfb2..273dd87 100644 (file)
@@ -1376,8 +1376,7 @@ int dict_str2oid(char const *ptr, unsigned int *pvalue, unsigned int *pvendor,
 {
        char const *p;
        unsigned int attr;
-       DICT_ATTR const *da = NULL;
-
+       
 #ifdef WITH_DICT_OID_DEBUG
        fprintf(stderr, "PARSING %s tlv_depth %d pvalue %08x pvendor %08x\n", ptr,
                tlv_depth, *pvalue, *pvendor);
@@ -1418,6 +1417,8 @@ int dict_str2oid(char const *ptr, unsigned int *pvalue, unsigned int *pvendor,
                 *      We have an OID, look up the attribute to see what it is.
                 */
                if (attr != PW_VENDOR_SPECIFIC) {
+                       DICT_ATTR const *da;
+
                        da = dict_attrbyvalue(attr, 0);
                        if (!da) {
                                *pvalue = attr;
@@ -1545,6 +1546,22 @@ keep_parsing:
                }
 
                attr <<= fr_attr_shift[tlv_depth];
+
+#ifdef WITH_DICT_OID_DEBUG
+               if (*pvendor) {
+                       DICT_ATTR const *da;
+
+                       da = dict_parent(*pvalue | attr, *pvendor);
+                       if (!da) {
+                               fprintf(stderr, "STR2OID FAILED PARENT %08x | %08x, %08x\n",
+                                       *pvalue, attr, *pvendor);
+                       } else if ((da->attr != *pvalue) || (da->vendor != *pvendor)) {
+                               fprintf(stderr, "STR2OID DISAGREEMENT WITH PARENT %08x, %08x\t%08x, %08x\n",
+                                       *pvalue, *pvendor, da->attr, da->vendor);
+                       }
+               }
+#endif
+
                *pvalue |= attr;
 
 #ifdef WITH_DHCP
index c3bc263..3d4219c 100644 (file)
@@ -162,10 +162,6 @@ static size_t linelog_escape_func(UNUSED REQUEST *request,
                char *out, size_t outlen, char const *in,
                UNUSED void *arg)
 {
-       const char *p = in;
-       char *q = out;
-       size_t freespace = outlen;
-
        if (outlen == 0) return 0;
 
        if (outlen == 1) {
@@ -173,63 +169,7 @@ static size_t linelog_escape_func(UNUSED REQUEST *request,
                return 0;
        }
 
-       while (*p) {
-               int sp;
-               size_t len;
-
-               if (freespace < 2) break;
-
-               switch (*p) {
-               case '\r':
-                       sp = 'r';
-                       break;
-
-               case '\n':
-                       sp = 'n';
-                       break;
-
-               case '\t':
-                       sp = 't';
-                       break;
-
-               case '\\':
-                       sp = '\\';
-                       break;
-
-               default:
-                       sp = 0;
-                       break;
-               }
-
-               if (sp) {
-                       if (freespace < 3) break;
-
-                       *q++ = '\\';
-                       *q++ = sp;
-                       freespace -= 2;
-                       p++;
-                       continue;
-               }
-
-               if (*p >= ' ') {
-                       *(q++) = *(p++);
-                       freespace--;
-                       continue;
-               }
-
-               if (freespace < 5) break;
-
-               snprintf(q, freespace, "\\%03o", (uint8_t) *p);
-
-               len = strlen(q);
-               freespace -= len;
-               p++;
-               q += len;
-       }
-
-       *q = '\0';
-
-       return q - out;
+       return fr_prints(out, outlen, in, -1, 0);
 }
 
 static rlm_rcode_t CC_HINT(nonnull) mod_do_linelog(void *instance, REQUEST *request)