Fix formatting of switch statements
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 23 Jul 2014 16:40:57 +0000 (12:40 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 23 Jul 2014 16:42:43 +0000 (12:42 -0400)
52 files changed:
src/lib/dict.c
src/lib/getaddrinfo.c
src/lib/pcap.c
src/lib/print.c
src/lib/radius.c
src/lib/snprintf.c
src/lib/token.c
src/lib/valuepair.c
src/main/acct.c
src/main/auth.c
src/main/collectd.c
src/main/detail.c
src/main/evaluate.c
src/main/modules.c
src/main/radwho.c
src/main/realms.c
src/main/soh.c
src/main/tls.c
src/main/unittest.c
src/main/util.c
src/main/valuepair.c
src/main/xlat.c
src/modules/rlm_cache/rlm_cache.c
src/modules/rlm_couchbase/couchbase.c
src/modules/rlm_couchbase/mod.c
src/modules/rlm_couchbase/rlm_couchbase.c
src/modules/rlm_eap/types/rlm_eap_mschapv2/rlm_eap_mschapv2.c
src/modules/rlm_eap/types/rlm_eap_peap/peap.c
src/modules/rlm_eap/types/rlm_eap_sim/rlm_eap_sim.c
src/modules/rlm_eap/types/rlm_eap_tnc/rlm_eap_tnc.c
src/modules/rlm_eap/types/rlm_eap_ttls/rlm_eap_ttls.c
src/modules/rlm_eap/types/rlm_eap_ttls/ttls.c
src/modules/rlm_exec/rlm_exec.c
src/modules/rlm_expr/paircmp.c
src/modules/rlm_expr/rlm_expr.c
src/modules/rlm_ippool/rlm_ippool_tool.c
src/modules/rlm_ldap/attrmap.c
src/modules/rlm_ldap/clients.c
src/modules/rlm_ldap/groups.c
src/modules/rlm_ldap/ldap.c
src/modules/rlm_ldap/rlm_ldap.c
src/modules/rlm_mschap/rlm_mschap.c
src/modules/rlm_otp/otp_pw_valid.c
src/modules/rlm_pam/rlm_pam.c
src/modules/rlm_perl/rlm_perl.c
src/modules/rlm_radutmp/rlm_radutmp.c
src/modules/rlm_rediswho/rlm_rediswho.c
src/modules/rlm_soh/rlm_soh.c
src/modules/rlm_sql/drivers/rlm_sql_firebird/sql_fbapi.c
src/modules/rlm_sql/rlm_sql.c
src/modules/rlm_sqlhpwippool/rlm_sqlhpwippool.c
src/modules/rlm_unix/rlm_unix.c

index 38b8584..7d6fa13 100644 (file)
@@ -1031,36 +1031,36 @@ int dict_addvalue(char const *namestr, char const *attrstr, int value)
                 *      Don't worry about fixups...
                 */
                switch (da->type) {
-                       case PW_TYPE_BYTE:
-                               if (value > 255) {
-                                       fr_pool_free(dval);
-                                       fr_strerror_printf("dict_addvalue: ATTRIBUTEs of type 'byte' cannot have VALUEs larger than 255");
-                                       return -1;
-                               }
-                               break;
-                       case PW_TYPE_SHORT:
-                               if (value > 65535) {
-                                       fr_pool_free(dval);
-                                       fr_strerror_printf("dict_addvalue: ATTRIBUTEs of type 'short' cannot have VALUEs larger than 65535");
-                                       return -1;
-                               }
-                               break;
+               case PW_TYPE_BYTE:
+                       if (value > 255) {
+                               fr_pool_free(dval);
+                               fr_strerror_printf("dict_addvalue: ATTRIBUTEs of type 'byte' cannot have VALUEs larger than 255");
+                               return -1;
+                       }
+                       break;
+               case PW_TYPE_SHORT:
+                       if (value > 65535) {
+                               fr_pool_free(dval);
+                               fr_strerror_printf("dict_addvalue: ATTRIBUTEs of type 'short' cannot have VALUEs larger than 65535");
+                               return -1;
+                       }
+                       break;
 
-                               /*
-                                *      Allow octets for now, because
-                                *      of dictionary.cablelabs
-                                */
-                       case PW_TYPE_OCTETS:
+                       /*
+                        *      Allow octets for now, because
+                        *      of dictionary.cablelabs
+                        */
+               case PW_TYPE_OCTETS:
 
-                       case PW_TYPE_INTEGER:
-                               break;
+               case PW_TYPE_INTEGER:
+                       break;
 
-                       case PW_TYPE_INTEGER64:
-                       default:
-                               fr_pool_free(dval);
-                               fr_strerror_printf("dict_addvalue: VALUEs cannot be defined for attributes of type '%s'",
-                                          fr_int2str(dict_attr_types, da->type, "?Unknown?"));
-                               return -1;
+               case PW_TYPE_INTEGER64:
+               default:
+                       fr_pool_free(dval);
+                       fr_strerror_printf("dict_addvalue: VALUEs cannot be defined for attributes of type '%s'",
+                                  fr_int2str(dict_attr_types, da->type, "?Unknown?"));
+                       return -1;
                }
        } else {
                value_fixup_t *fixup;
@@ -1537,21 +1537,21 @@ static int process_attribute(char const* fn, int const line,
                                flags.array = 1;
 
                                switch (type) {
-                                       case PW_TYPE_IPV4_ADDR:
-                                       case PW_TYPE_IPV6_ADDR:
-                                       case PW_TYPE_BYTE:
-                                       case PW_TYPE_SHORT:
-                                       case PW_TYPE_INTEGER:
-                                       case PW_TYPE_DATE:
-                                       case PW_TYPE_STRING:
-                                               break;
-
-                                       default:
-                                               fr_strerror_printf( "dict_init: %s[%d] \"%s\" type cannot have the "
-                                                                  "\"array\" flag set",
-                                                                  fn, line,
-                                                                  fr_int2str(dict_attr_types, type, "<UNKNOWN>"));
-                                               return -1;
+                               case PW_TYPE_IPV4_ADDR:
+                               case PW_TYPE_IPV6_ADDR:
+                               case PW_TYPE_BYTE:
+                               case PW_TYPE_SHORT:
+                               case PW_TYPE_INTEGER:
+                               case PW_TYPE_DATE:
+                               case PW_TYPE_STRING:
+                                       break;
+
+                               default:
+                                       fr_strerror_printf( "dict_init: %s[%d] \"%s\" type cannot have the "
+                                                          "\"array\" flag set",
+                                                          fn, line,
+                                                          fr_int2str(dict_attr_types, type, "<UNKNOWN>"));
+                                       return -1;
                                }
 
                        } else if (strncmp(key, "concat", 6) == 0) {
index 315ff46..aca0be4 100644 (file)
@@ -60,11 +60,11 @@ static pthread_mutex_t fr_hostbyaddr_mutex;
  * copy the data and not pointers
  *
  * struct hostent {
- *    char    *h_name; * official name of host *
- *    char    **h_aliases;    * alias list *
- *    int     h_addrtype;     * host address type *
- *    int     h_length;       * length of address *
- *    char    **h_addr_list;  * list of addresses *
+ *     char    *h_name;        * official name of host *
+ *     char    **h_aliases;    * alias list *
+ *     int      h_addrtype;     * host address type *
+ *     int      h_length;         * length of address *
+ *     char    **h_addr_list;  * list of addresses *
  * }
  * This struct contains 3 pointers as members.
  * The data from these pointers is copied into a buffer.
@@ -78,55 +78,55 @@ static pthread_mutex_t fr_hostbyaddr_mutex;
 static int copy_hostent(struct hostent *from, struct hostent *to,
                        char *buffer, int buflen, int *error)
 {
-    int i, len;
-    char *ptr = buffer;
-
-    *error = 0;
-    to->h_addrtype = from->h_addrtype;
-    to->h_length = from->h_length;
-    to->h_name = (char *)ptr;
-
-    /* copy hostname to buffer */
-    len=strlen(from->h_name)+1;
-    strcpy(ptr, from->h_name);
-    ptr += len;
-
-    /* copy aliases to buffer */
-    to->h_aliases = (char**)ptr;
-    for(i = 0; from->h_aliases[i]; i++);
-    ptr += (i+1) * sizeof(char *);
-
-    for(i = 0; from->h_aliases[i]; i++) {
-       len = strlen(from->h_aliases[i])+1;
-       if ((ptr-buffer)+len < buflen) {
+       int i, len;
+       char *ptr = buffer;
+
+       *error = 0;
+       to->h_addrtype = from->h_addrtype;
+       to->h_length = from->h_length;
+       to->h_name = (char *)ptr;
+
+       /* copy hostname to buffer */
+       len=strlen(from->h_name)+1;
+       strcpy(ptr, from->h_name);
+       ptr += len;
+
+       /* copy aliases to buffer */
+       to->h_aliases = (char**)ptr;
+       for(i = 0; from->h_aliases[i]; i++);
+       ptr += (i+1) * sizeof(char *);
+
+       for(i = 0; from->h_aliases[i]; i++) {
+          len = strlen(from->h_aliases[i])+1;
+          if ((ptr-buffer)+len < buflen) {
           to->h_aliases[i] = ptr;
-              strcpy(ptr, from->h_aliases[i]);
+                  strcpy(ptr, from->h_aliases[i]);
           ptr += len;
-       } else {
+          } else {
           *error = BUFFER_OVERFLOW;
           return *error;
-       }
-    }
-    to->h_aliases[i] = NULL;
-
-    /* copy addr_list to buffer */
-    to->h_addr_list = (char**)ptr;
-    for(i = 0; (int *)from->h_addr_list[i] != 0; i++);
-    ptr += (i+1) * sizeof(int *);
-
-    for(i = 0; (int *)from->h_addr_list[i] != 0; i++) {
-       len = sizeof(int);
-       if ((ptr-buffer)+len < buflen) {
+          }
+       }
+       to->h_aliases[i] = NULL;
+
+       /* copy addr_list to buffer */
+       to->h_addr_list = (char**)ptr;
+       for(i = 0; (int *)from->h_addr_list[i] != 0; i++);
+       ptr += (i+1) * sizeof(int *);
+
+       for(i = 0; (int *)from->h_addr_list[i] != 0; i++) {
+          len = sizeof(int);
+          if ((ptr-buffer)+len < buflen) {
           to->h_addr_list[i] = ptr;
           memcpy(ptr, from->h_addr_list[i], len);
           ptr += len;
-       } else {
+          } else {
           *error = BUFFER_OVERFLOW;
-           return *error;
-       }
-    }
-    to->h_addr_list[i] = 0;
-    return *error;
+               return *error;
+          }
+       }
+       to->h_addr_list[i] = 0;
+       return *error;
 }
 #endif /* (LOCAL_GETHOSTBYNAMER == 1) || (LOCAL_GETHOSTBYADDRR == 1) */
 
@@ -135,30 +135,30 @@ static struct hostent *
 gethostbyname_r(char const *hostname, struct hostent *result,
           char *buffer, int buflen, int *error)
 {
-    struct hostent *hp;
+       struct hostent *hp;
 
 #ifdef HAVE_PTHREAD_H
-    if (fr_hostbyname == 0) {
+       if (fr_hostbyname == 0) {
        pthread_mutex_init(&fr_hostbyname_mutex, NULL);
        fr_hostbyname = 1;
-    }
-    pthread_mutex_lock(&fr_hostbyname_mutex);
+       }
+       pthread_mutex_lock(&fr_hostbyname_mutex);
 #endif
 
-    hp = gethostbyname(hostname);
-    if ((!hp) || (hp->h_addrtype != AF_INET) || (hp->h_length != 4)) {
+       hp = gethostbyname(hostname);
+       if ((!hp) || (hp->h_addrtype != AF_INET) || (hp->h_length != 4)) {
         *error = h_errno;
         hp = NULL;
-    } else {
+       } else {
         copy_hostent(hp, result, buffer, buflen, error);
         hp = result;
-    }
+       }
 
 #ifdef HAVE_PTHREAD_H
-    pthread_mutex_unlock(&fr_hostbyname_mutex);
+       pthread_mutex_unlock(&fr_hostbyname_mutex);
 #endif
 
-    return hp;
+       return hp;
 }
 #endif /* GETHOSTBYNAMERSTYLE */
 
@@ -168,30 +168,30 @@ static struct hostent *
 gethostbyaddr_r(char const *addr, int len, int type, struct hostent *result,
                char *buffer, int buflen, int *error)
 {
-    struct hostent *hp;
+       struct hostent *hp;
 
 #ifdef HAVE_PTHREAD_H
-    if (fr_hostbyaddr == 0) {
+       if (fr_hostbyaddr == 0) {
        pthread_mutex_init(&fr_hostbyaddr_mutex, NULL);
        fr_hostbyaddr = 1;
-    }
-    pthread_mutex_lock(&fr_hostbyaddr_mutex);
+       }
+       pthread_mutex_lock(&fr_hostbyaddr_mutex);
 #endif
 
-    hp = gethostbyaddr(addr, len, type);
-    if ((!hp) || (hp->h_addrtype != AF_INET) || (hp->h_length != 4)) {
+       hp = gethostbyaddr(addr, len, type);
+       if ((!hp) || (hp->h_addrtype != AF_INET) || (hp->h_length != 4)) {
         *error = h_errno;
         hp = NULL;
-    } else {
+       } else {
         copy_hostent(hp, result, buffer, buflen, error);
         hp = result;
-    }
+       }
 
 #ifdef HAVE_PTHREAD_H
-    pthread_mutex_unlock(&fr_hostbyaddr_mutex);
+       pthread_mutex_unlock(&fr_hostbyaddr_mutex);
 #endif
 
-    return hp;
+       return hp;
 }
 #endif /* GETHOSTBYADDRRSTYLE */
 
@@ -206,11 +206,11 @@ gethostbyaddr_r(char const *addr, int len, int type, struct hostent *result,
 static struct addrinfo *
 malloc_ai(uint16_t port, u_long addr, int socktype, int proto)
 {
-    struct addrinfo *ai;
+       struct addrinfo *ai;
 
-    ai = (struct addrinfo *)malloc(sizeof(struct addrinfo) +
+       ai = (struct addrinfo *)malloc(sizeof(struct addrinfo) +
                                   sizeof(struct sockaddr_in));
-    if (ai) {
+       if (ai) {
        memset(ai, 0, sizeof(struct addrinfo) + sizeof(struct sockaddr_in));
        ai->ai_addr = (struct sockaddr *)(ai + 1);
        ai->ai_addrlen = sizeof(struct sockaddr_in);
@@ -223,157 +223,157 @@ malloc_ai(uint16_t port, u_long addr, int socktype, int proto)
        ai->ai_socktype = socktype;
        ai->ai_protocol = proto;
        return ai;
-    } else {
+       } else {
        return NULL;
-    }
+       }
 }
 
 char const *
 gai_strerror(int ecode)
 {
-    switch (ecode) {
-    case EAI_MEMORY:
+       switch (ecode) {
+       case EAI_MEMORY:
        return "memory allocation failure.";
-    case EAI_FAMILY:
+       case EAI_FAMILY:
        return "ai_family not supported.";
-    case EAI_NONAME:
+       case EAI_NONAME:
        return "hostname nor servname provided, or not known.";
-    case EAI_SERVICE:
+       case EAI_SERVICE:
        return "servname not supported for ai_socktype.";
-    default:
+       default:
        return "unknown error.";
-    }
+       }
 }
 
 void
 freeaddrinfo(struct addrinfo *ai)
 {
-    struct addrinfo *next;
+       struct addrinfo *next;
 
-    if (ai->ai_canonname)
+       if (ai->ai_canonname)
        free(ai->ai_canonname);
-    do {
+       do {
        next = ai->ai_next;
        free(ai);
-    } while ((ai = next) != NULL);
+       } while ((ai = next) != NULL);
 }
 
 int
 getaddrinfo(char const *hostname, char const *servname,
-           struct addrinfo const *hints, struct addrinfo **res)
+               struct addrinfo const *hints, struct addrinfo **res)
 {
-    struct addrinfo *cur, *prev = NULL;
-    struct hostent *hp;
-    struct hostent result;
-    struct in_addr in;
-    int i, socktype, proto;
-    uint16_t port = 0;
-    int error;
-    char buffer[2048];
-
-    if (hints && hints->ai_family != PF_INET && hints->ai_family != PF_UNSPEC)
+       struct addrinfo *cur, *prev = NULL;
+       struct hostent *hp;
+       struct hostent result;
+       struct in_addr in;
+       int i, socktype, proto;
+       uint16_t port = 0;
+       int error;
+       char buffer[2048];
+
+       if (hints && hints->ai_family != PF_INET && hints->ai_family != PF_UNSPEC)
        return EAI_FAMILY;
 
-    socktype = (hints && hints->ai_socktype) ? hints->ai_socktype
-                                            : SOCK_STREAM;
-    if (hints && hints->ai_protocol)
+       socktype = (hints && hints->ai_socktype) ? hints->ai_socktype
+                                                : SOCK_STREAM;
+       if (hints && hints->ai_protocol)
        proto = hints->ai_protocol;
-    else {
+       else {
        switch (socktype) {
        case SOCK_DGRAM:
-           proto = IPPROTO_UDP;
-           break;
+               proto = IPPROTO_UDP;
+               break;
        case SOCK_STREAM:
-           proto = IPPROTO_TCP;
-           break;
+               proto = IPPROTO_TCP;
+               break;
        default:
-           proto = 0;
-           break;
+               proto = 0;
+               break;
        }
-    }
-    if (servname) {
+       }
+       if (servname) {
        if (isdigit((int)*servname))
-           port = htons(atoi(servname));
+               port = htons(atoi(servname));
        else {
-           struct servent *se;
-           char const *pe_proto;
+               struct servent *se;
+               char const *pe_proto;
 
-           switch (socktype) {
-           case SOCK_DGRAM:
+               switch (socktype) {
+               case SOCK_DGRAM:
                pe_proto = "udp";
                break;
-           case SOCK_STREAM:
+               case SOCK_STREAM:
                pe_proto = "tcp";
                break;
-           default:
+               default:
                pe_proto = NULL;
                break;
-           }
-           if ((se = getservbyname(servname, pe_proto)) == NULL)
+               }
+               if ((se = getservbyname(servname, pe_proto)) == NULL)
                return EAI_SERVICE;
-           port = se->s_port;
+               port = se->s_port;
        }
-    }
-    if (!hostname) {
+       }
+       if (!hostname) {
        if (hints && hints->ai_flags & AI_PASSIVE)
-           *res = malloc_ai(port, htonl(0x00000000), socktype, proto);
+               *res = malloc_ai(port, htonl(0x00000000), socktype, proto);
        else
-           *res = malloc_ai(port, htonl(0x7f000001), socktype, proto);
+               *res = malloc_ai(port, htonl(0x7f000001), socktype, proto);
        if (*res)
-           return 0;
+               return 0;
        else
-           return EAI_MEMORY;
-    }
-    /* Numeric IP Address */
-    if (inet_aton(hostname, &in)) {
+               return EAI_MEMORY;
+       }
+       /* Numeric IP Address */
+       if (inet_aton(hostname, &in)) {
        *res = malloc_ai(port, in.s_addr, socktype, proto);
        if (*res)
-           return 0;
+               return 0;
        else
-           return EAI_MEMORY;
-    }
-    if (hints && hints->ai_flags & AI_NUMERICHOST)
+               return EAI_MEMORY;
+       }
+       if (hints && hints->ai_flags & AI_NUMERICHOST)
        return EAI_NONAME;
 
-    /* DNS Lookup */
+       /* DNS Lookup */
 #ifdef GETHOSTBYNAMERSTYLE
 #if GETHOSTBYNAMERSTYLE == SYSVSTYLE
-    hp = gethostbyname_r(hostname, &result, buffer, sizeof(buffer), &error);
+       hp = gethostbyname_r(hostname, &result, buffer, sizeof(buffer), &error);
 #elif GETHOSTBYNAMERSTYLE == GNUSTYLE
-    if (gethostbyname_r(hostname, &result, buffer,
+       if (gethostbyname_r(hostname, &result, buffer,
         sizeof(buffer), &hp, &error) != 0) {
                hp = NULL;
        }
 #else
-    hp = gethostbyname_r(hostname, &result, buffer, sizeof(buffer), &error);
+       hp = gethostbyname_r(hostname, &result, buffer, sizeof(buffer), &error);
 #endif
 #else
-    hp = gethostbyname_r(hostname, &result, buffer, sizeof(buffer), &error);
+       hp = gethostbyname_r(hostname, &result, buffer, sizeof(buffer), &error);
 #endif
-    if (hp && hp->h_name && hp->h_name[0] && hp->h_addr_list[0]) {
+       if (hp && hp->h_name && hp->h_name[0] && hp->h_addr_list[0]) {
        for (i = 0; hp->h_addr_list[i]; i++) {
-           if ((cur = malloc_ai(port,
+               if ((cur = malloc_ai(port,
                                ((struct in_addr *)hp->h_addr_list[i])->s_addr,
                                socktype, proto)) == NULL) {
                if (*res)
-                   freeaddrinfo(*res);
+                       freeaddrinfo(*res);
                return EAI_MEMORY;
-           }
-           if (prev)
+               }
+               if (prev)
                prev->ai_next = cur;
-           else
+               else
                *res = cur;
-           prev = cur;
+               prev = cur;
        }
        if (hints && hints->ai_flags & AI_CANONNAME && *res) {
-           if (((*res)->ai_canonname = strdup(hp->h_name)) == NULL) {
+               if (((*res)->ai_canonname = strdup(hp->h_name)) == NULL) {
                freeaddrinfo(*res);
                return EAI_MEMORY;
-           }
+               }
        }
        return 0;
-    }
-    return EAI_NONAME;
+       }
+       return EAI_NONAME;
 }
 #endif /* HAVE_GETADDRINFO */
 
@@ -381,74 +381,74 @@ getaddrinfo(char const *hostname, char const *servname,
 #ifndef HAVE_GETNAMEINFO
 int
 getnameinfo(struct sockaddr const  *sa, socklen_t salen, char *host, size_t hostlen, char *serv, size_t servlen,
-           unsigned int flags)
+               unsigned int flags)
 {
-    const struct sockaddr_in *sin = (struct sockaddr_in const *)sa;
-    struct hostent *hp;
-    struct hostent result;
-    char tmpserv[16];
-    char buffer[2048];
-    int error;
-
-    if (serv) {
+       const struct sockaddr_in *sin = (struct sockaddr_in const *)sa;
+       struct hostent *hp;
+       struct hostent result;
+       char tmpserv[16];
+       char buffer[2048];
+       int error;
+
+       if (serv) {
        snprintf(tmpserv, sizeof(tmpserv), "%d", ntohs(sin->sin_port));
        if (strlen(tmpserv) > servlen)
-           return EAI_MEMORY;
+               return EAI_MEMORY;
        else
-           strcpy(serv, tmpserv);
-    }
-    if (host) {
+               strcpy(serv, tmpserv);
+       }
+       if (host) {
        if (flags & NI_NUMERICHOST) {
-           /*  No Reverse DNS lookup */
-           if (flags & NI_NAMEREQD)
+               /*  No Reverse DNS lookup */
+               if (flags & NI_NAMEREQD)
                return EAI_NONAME;
-           if (strlen(inet_ntoa(sin->sin_addr)) >= hostlen)
+               if (strlen(inet_ntoa(sin->sin_addr)) >= hostlen)
                return EAI_MEMORY;
-           else {
+               else {
                strcpy(host, inet_ntoa(sin->sin_addr));
                return 0;
-           }
+               }
        } else {
        /*  Reverse DNS lookup required */
 #ifdef GETHOSTBYADDRRSTYLE
 #if GETHOSTBYADDRRSTYLE == SYSVSTYLE
-           hp = gethostbyaddr_r((char const *)&sin->sin_addr,
-                              salen, AF_INET,
-                              &result, buffer, sizeof(buffer), &error);
+               hp = gethostbyaddr_r((char const *)&sin->sin_addr,
+                                  salen, AF_INET,
+                                  &result, buffer, sizeof(buffer), &error);
 #elif GETHOSTBYADDRRSTYLE == GNUSTYLE
-           if (gethostbyaddr_r((char const *)&sin->sin_addr,
-                              salen, AF_INET,
-                                   &result, buffer, sizeof(buffer),
-                                   &hp, &error) != 0) {
+               if (gethostbyaddr_r((char const *)&sin->sin_addr,
+                                  salen, AF_INET,
+                                       &result, buffer, sizeof(buffer),
+                                       &hp, &error) != 0) {
                        hp = NULL;
-            }
+                }
 #else
-           hp = gethostbyaddr_r((char const *)&sin->sin_addr,
-                              salen, AF_INET,
-                              &result, buffer, sizeof(buffer), &error);
+               hp = gethostbyaddr_r((char const *)&sin->sin_addr,
+                                  salen, AF_INET,
+                                  &result, buffer, sizeof(buffer), &error);
 #endif
 #else
-           hp = gethostbyaddr_r((char const *)&sin->sin_addr,
-                              salen, AF_INET,
-                              &result, buffer, sizeof(buffer), &error);
+               hp = gethostbyaddr_r((char const *)&sin->sin_addr,
+                                  salen, AF_INET,
+                                  &result, buffer, sizeof(buffer), &error);
 #endif
-           if (hp)
+               if (hp)
                if (strlen(hp->h_name) >= hostlen)
-                   return EAI_MEMORY;
+                       return EAI_MEMORY;
                else {
-                   strcpy(host, hp->h_name);
-                   return 0;
+                       strcpy(host, hp->h_name);
+                       return 0;
                }
-           else if (flags & NI_NAMEREQD)
+               else if (flags & NI_NAMEREQD)
                return EAI_NONAME;
-           else if (strlen(inet_ntoa(sin->sin_addr)) >= hostlen)
+               else if (strlen(inet_ntoa(sin->sin_addr)) >= hostlen)
                return EAI_MEMORY;
-           else {
+               else {
                strcpy(host, inet_ntoa(sin->sin_addr));
                return 0;
-           }
+               }
        }
-    }
-    return 0;
+       }
+       return 0;
 }
 #endif /* HAVE_GETNAMEINFO */
index c64ae1a..318ca73 100644 (file)
@@ -45,30 +45,30 @@ const FR_NAME_NUMBER pcap_types[] = {
  */
 static int _free_pcap(fr_pcap_t *pcap) {
        switch (pcap->type) {
-               case PCAP_INTERFACE_IN:
-               case PCAP_INTERFACE_OUT:
-               case PCAP_FILE_IN:
-               case PCAP_STDIO_IN:
-                       if (pcap->handle) {
-                               pcap_close(pcap->handle);
-
-                               if (pcap->fd > 0) {
-                                       close(pcap->fd);
-                               }
+       case PCAP_INTERFACE_IN:
+       case PCAP_INTERFACE_OUT:
+       case PCAP_FILE_IN:
+       case PCAP_STDIO_IN:
+               if (pcap->handle) {
+                       pcap_close(pcap->handle);
+
+                       if (pcap->fd > 0) {
+                               close(pcap->fd);
                        }
+               }
 
-                       break;
+               break;
 
-               case PCAP_FILE_OUT:
-               case PCAP_STDIO_OUT:
-                       if (pcap->dumper) {
-                               pcap_dump_flush(pcap->dumper);
-                               pcap_dump_close(pcap->dumper);
-                       }
+       case PCAP_FILE_OUT:
+       case PCAP_STDIO_OUT:
+               if (pcap->dumper) {
+                       pcap_dump_flush(pcap->dumper);
+                       pcap_dump_close(pcap->dumper);
+               }
 
-                       break;
-               case PCAP_INVALID:
-                       break;
+               break;
+       case PCAP_INVALID:
+               break;
        }
 
        return 0;
index cf83d4f..64056d3 100644 (file)
@@ -176,18 +176,23 @@ size_t fr_print_string(char const *in, size_t inlen, char *out, size_t outlen)
                case '\\':
                        sp = '\\';
                        break;
+
                case '\r':
                        sp = 'r';
                        break;
+
                case '\n':
                        sp = 'n';
                        break;
+
                case '\t':
                        sp = 't';
                        break;
+
                case '"':
                        sp = '"';
                        break;
+
                default:
                        sp = '\0';
                        break;
@@ -582,18 +587,18 @@ size_t vp_prints_value_json(char *out, size_t outlen, VALUE_PAIR const *vp)
 
        if (!vp->da->flags.has_tag) {
                switch (vp->da->type) {
-                       case PW_TYPE_INTEGER:
-                       case PW_TYPE_BYTE:
-                       case PW_TYPE_SHORT:
-                               if (vp->da->flags.has_value) break;
+               case PW_TYPE_INTEGER:
+               case PW_TYPE_BYTE:
+               case PW_TYPE_SHORT:
+                       if (vp->da->flags.has_value) break;
 
-                               return snprintf(out, freespace, "%u", vp->vp_integer);
+                       return snprintf(out, freespace, "%u", vp->vp_integer);
 
-                       case PW_TYPE_SIGNED:
-                               return snprintf(out, freespace, "%d", vp->vp_signed);
+               case PW_TYPE_SIGNED:
+                       return snprintf(out, freespace, "%d", vp->vp_signed);
 
-                       default:
-                               break;
+               default:
+                       break;
                }
        }
 
@@ -603,71 +608,71 @@ size_t vp_prints_value_json(char *out, size_t outlen, VALUE_PAIR const *vp)
        freespace--;
 
        switch (vp->da->type) {
-               case PW_TYPE_STRING:
-                       for (q = vp->vp_strvalue; q < vp->vp_strvalue + vp->length; q++) {
-                               /* Indicate truncation */
-                               if (freespace < 3) return outlen + 1;
-
-                               if (*q == '"') {
-                                       *out++ = '\\';
-                                       *out++ = '"';
-                                       freespace -= 2;
-                               } else if (*q == '\\') {
-                                       *out++ = '\\';
-                                       *out++ = '\\';
-                                       freespace -= 2;
-                               } else if (*q == '/') {
-                                       *out++ = '\\';
-                                       *out++ = '/';
-                                       freespace -= 2;
-                               } else if (*q >= ' ') {
-                                       *out++ = *q;
+       case PW_TYPE_STRING:
+               for (q = vp->vp_strvalue; q < vp->vp_strvalue + vp->length; q++) {
+                       /* Indicate truncation */
+                       if (freespace < 3) return outlen + 1;
+
+                       if (*q == '"') {
+                               *out++ = '\\';
+                               *out++ = '"';
+                               freespace -= 2;
+                       } else if (*q == '\\') {
+                               *out++ = '\\';
+                               *out++ = '\\';
+                               freespace -= 2;
+                       } else if (*q == '/') {
+                               *out++ = '\\';
+                               *out++ = '/';
+                               freespace -= 2;
+                       } else if (*q >= ' ') {
+                               *out++ = *q;
+                               freespace--;
+                       } else {
+                               *out++ = '\\';
+                               freespace--;
+
+                               switch (*q) {
+                               case '\b':
+                                       *out++ = 'b';
                                        freespace--;
-                               } else {
-                                       *out++ = '\\';
+                                       break;
+
+                               case '\f':
+                                       *out++ = 'f';
+                                       freespace--;
+                                       break;
+
+                               case '\n':
+                                       *out++ = 'b';
                                        freespace--;
+                                       break;
 
-                                       switch (*q) {
-                                       case '\b':
-                                               *out++ = 'b';
-                                               freespace--;
-                                               break;
-
-                                       case '\f':
-                                               *out++ = 'f';
-                                               freespace--;
-                                               break;
-
-                                       case '\n':
-                                               *out++ = 'b';
-                                               freespace--;
-                                               break;
-
-                                       case '\r':
-                                               *out++ = 'r';
-                                               freespace--;
-                                               break;
-
-                                       case '\t':
-                                               *out++ = 't';
-                                               freespace--;
-                                               break;
-                                       default:
-                                               len = snprintf(out, freespace, "u%04X", *q);
-                                               if (is_truncated(len, freespace)) return (outlen - freespace) + len;
-                                               out += len;
-                                               freespace -= len;
-                                       }
+                               case '\r':
+                                       *out++ = 'r';
+                                       freespace--;
+                                       break;
+
+                               case '\t':
+                                       *out++ = 't';
+                                       freespace--;
+                                       break;
+                               default:
+                                       len = snprintf(out, freespace, "u%04X", *q);
+                                       if (is_truncated(len, freespace)) return (outlen - freespace) + len;
+                                       out += len;
+                                       freespace -= len;
                                }
                        }
-                       break;
+               }
+               break;
 
-               default:
-                       len = vp_prints_value(out, freespace, vp, 0);
-                       if (is_truncated(len, freespace)) return (outlen - freespace) + len;
-                       out += len;
-                       freespace -= len;
-                       break;
+       default:
+               len = vp_prints_value(out, freespace, vp, 0);
+               if (is_truncated(len, freespace)) return (outlen - freespace) + len;
+               out += len;
+               freespace -= len;
+               break;
        }
 
        /* Indicate truncation */
index 0102a4b..6a1b951 100644 (file)
@@ -2846,62 +2846,62 @@ int rad_verify(RADIUS_PACKET *packet, RADIUS_PACKET *original,
         *      Calculate and/or verify Request or Response Authenticator.
         */
        switch (packet->code) {
-               int rcode;
-               char buffer[32];
-
-               case PW_CODE_ACCESS_REQUEST:
-               case PW_CODE_STATUS_SERVER:
-                       /*
-                        *      The authentication vector is random
-                        *      nonsense, invented by the client.
-                        */
-                       break;
+       int rcode;
+       char buffer[32];
 
-               case PW_CODE_COA_REQUEST:
-               case PW_CODE_DISCONNECT_REQUEST:
-               case PW_CODE_ACCOUNTING_REQUEST:
-                       if (calc_acctdigest(packet, secret) > 1) {
-                               fr_strerror_printf("Received %s packet "
-                                          "from client %s with invalid Request Authenticator!  (Shared secret is incorrect.)",
-                                          fr_packet_codes[packet->code],
-                                          inet_ntop(packet->src_ipaddr.af,
-                                                    &packet->src_ipaddr.ipaddr,
-                                                    buffer, sizeof(buffer)));
-                               return -1;
-                       }
-                       break;
+       case PW_CODE_ACCESS_REQUEST:
+       case PW_CODE_STATUS_SERVER:
+               /*
+                *      The authentication vector is random
+                *      nonsense, invented by the client.
+                */
+               break;
 
-                       /* Verify the reply digest */
-               case PW_CODE_ACCESS_ACCEPT:
-               case PW_CODE_ACCESS_REJECT:
-               case PW_CODE_ACCESS_CHALLENGE:
-               case PW_CODE_ACCOUNTING_RESPONSE:
-               case PW_CODE_DISCONNECT_ACK:
-               case PW_CODE_DISCONNECT_NAK:
-               case PW_CODE_COA_ACK:
-               case PW_CODE_COA_NAK:
-                       rcode = calc_replydigest(packet, original, secret);
-                       if (rcode > 1) {
-                               fr_strerror_printf("Received %s packet "
-                                          "from home server %s port %d with invalid Response Authenticator!  (Shared secret is incorrect.)",
-                                          fr_packet_codes[packet->code],
-                                          inet_ntop(packet->src_ipaddr.af,
-                                                    &packet->src_ipaddr.ipaddr,
-                                                    buffer, sizeof(buffer)),
-                                          packet->src_port);
-                               return -1;
-                       }
-                       break;
+       case PW_CODE_COA_REQUEST:
+       case PW_CODE_DISCONNECT_REQUEST:
+       case PW_CODE_ACCOUNTING_REQUEST:
+               if (calc_acctdigest(packet, secret) > 1) {
+                       fr_strerror_printf("Received %s packet "
+                                  "from client %s with invalid Request Authenticator!  (Shared secret is incorrect.)",
+                                  fr_packet_codes[packet->code],
+                                  inet_ntop(packet->src_ipaddr.af,
+                                            &packet->src_ipaddr.ipaddr,
+                                            buffer, sizeof(buffer)));
+                       return -1;
+               }
+               break;
 
-               default:
-                       fr_strerror_printf("Received Unknown packet code %d "
-                                  "from client %s port %d: Cannot validate Request/Response Authenticator",
-                                  packet->code,
+               /* Verify the reply digest */
+       case PW_CODE_ACCESS_ACCEPT:
+       case PW_CODE_ACCESS_REJECT:
+       case PW_CODE_ACCESS_CHALLENGE:
+       case PW_CODE_ACCOUNTING_RESPONSE:
+       case PW_CODE_DISCONNECT_ACK:
+       case PW_CODE_DISCONNECT_NAK:
+       case PW_CODE_COA_ACK:
+       case PW_CODE_COA_NAK:
+               rcode = calc_replydigest(packet, original, secret);
+               if (rcode > 1) {
+                       fr_strerror_printf("Received %s packet "
+                                  "from home server %s port %d with invalid Response Authenticator!  (Shared secret is incorrect.)",
+                                  fr_packet_codes[packet->code],
                                   inet_ntop(packet->src_ipaddr.af,
                                             &packet->src_ipaddr.ipaddr,
-                                                    buffer, sizeof(buffer)),
+                                            buffer, sizeof(buffer)),
                                   packet->src_port);
                        return -1;
+               }
+               break;
+
+       default:
+               fr_strerror_printf("Received Unknown packet code %d "
+                          "from client %s port %d: Cannot validate Request/Response Authenticator",
+                          packet->code,
+                          inet_ntop(packet->src_ipaddr.af,
+                                    &packet->src_ipaddr.ipaddr,
+                                            buffer, sizeof(buffer)),
+                          packet->src_port);
+               return -1;
        }
 
        return 0;
index 6738743..79184ff 100644 (file)
@@ -1,51 +1,51 @@
 
 /*
-   Unix snprintf implementation.
-   Version 1.4
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU Library General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU Library General Public License for more details.
-
-   You should have received a copy of the GNU Library General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-   Revision History:
-
-   1.4:
-      *  integrate in FreeRADIUS's libradius:
-         *  Fetched from: http://savannah.gnu.org/cgi-bin/viewcvs/mailutils/mailutils/lib/snprintf.c?rev=1.4
-         *  Fetched from: http://savannah.gnu.org/cgi-bin/viewcvs/mailutils/mailutils/lib/snprintf.h?rev=1.4
-         *  Replace config.h with autoconf.h
-         *  Protect with HAVE_SNPRINTF and HAVE_VSNPRINTF
-   1.3:
-      *  add #include <config.h> ifdef HAVE_CONFIG_H
-      *  cosmetic change, when exponent is 0 print xxxE+00
+        Unix snprintf implementation.
+        Version 1.4
+
+        This program is free software; you can redistribute it and/or modify
+        it under the terms of the GNU Library General Public License as published by
+        the Free Software Foundation; either version 2 of the License, or
+        (at your option) any later version.
+
+        This program is distributed in the hope that it will be useful,
+        but WITHOUT ANY WARRANTY; without even the implied warranty of
+        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.   See the
+        GNU Library General Public License for more details.
+
+        You should have received a copy of the GNU Library General Public License
+        along with this program; if not, write to the Free Software
+        Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+        Revision History:
+
+        1.4:
+                       *       integrate in FreeRADIUS's libradius:
+               *       Fetched from: http://savannah.gnu.org/cgi-bin/viewcvs/mailutils/mailutils/lib/snprintf.c?rev=1.4
+               *       Fetched from: http://savannah.gnu.org/cgi-bin/viewcvs/mailutils/mailutils/lib/snprintf.h?rev=1.4
+               *       Replace config.h with autoconf.h
+               *       Protect with HAVE_SNPRINTF and HAVE_VSNPRINTF
+        1.3:
+                       *       add #include <config.h> ifdef HAVE_CONFIG_H
+                       *       cosmetic change, when exponent is 0 print xxxE+00
         instead of xxxE-00
-   1.2:
-      *  put the program under LGPL.
-   1.1:
-      *  added changes from Miles Bader
-      *  corrected a bug with %f
-      *  added support for %#g
-      *  added more comments :-)
-   1.0:
-      *  supporting must ANSI syntaxic_sugars
-   0.0:
-      *  suppot %s %c %d
+        1.2:
+                       *       put the program under LGPL.
+        1.1:
+                       *       added changes from Miles Bader
+                       *       corrected a bug with %f
+                       *       added support for %#g
+                       *       added more comments :-)
+        1.0:
+                       *       supporting must ANSI syntaxic_sugars
+        0.0:
+                       *       suppot %s %c %d
 
  THANKS(for the patches and ideas):
-     Miles Bader
-     Cyrille Rustom
-     Jacek Slabocewiz
-     Mike Parker(mouse)
+                Miles Bader
+                Cyrille Rustom
+                Jacek Slabocewiz
+                Mike Parker(mouse)
 
 */
 
@@ -66,21 +66,21 @@ pow_10(n)
 int n;
 #endif
 {
-  int i;
-  double P;
-
-  if (n < 0)
-    for (i = 1, P = 1., n = -n ; i <= n ; i++) {P *= .1;}
-  else
-    for (i = 1, P = 1. ; i <= n ; i++) {P *= 10.0;}
-  return P;
+       int i;
+       double P;
+
+       if (n < 0)
+               for (i = 1, P = 1., n = -n ; i <= n ; i++) {P *= .1;}
+       else
+               for (i = 1, P = 1. ; i <= n ; i++) {P *= 10.0;}
+       return P;
 }
 
 /*
  * Find the integral part of the log in base 10
  * Note: this not a real log10()
         I just need and approximation(integerpart) of x in:
-         10^x ~= r
+               10^x ~= r
  * log_10(200) = 2;
  * log_10(250) = 2;
  */
@@ -92,19 +92,19 @@ log_10(r)
 double r;
 #endif
 {
-  int i = 0;
-  double result = 1.;
-
-  if (r < 0.)
-    r = -r;
-
-  if (r < 1.) {
-    while (result >= r) {result *= .1; i++;}
-    return (-i);
-  } else {
-    while (result <= r) {result *= 10.; i++;}
-    return (i - 1);
-  }
+       int i = 0;
+       double result = 1.;
+
+       if (r < 0.)
+               r = -r;
+
+       if (r < 1.) {
+               while (result >= r) {result *= .1; i++;}
+               return (-i);
+       } else {
+               while (result <= r) {result *= 10.; i++;}
+               return (i - 1);
+       }
 }
 
 /*
@@ -121,36 +121,36 @@ double real;
 double * ip;
 #endif
 {
-  int j;
-  double i, s, p;
-  double real_integral = 0.;
+       int j;
+       double i, s, p;
+       double real_integral = 0.;
 
 /* take care of the obvious */
 /* equal to zero ? */
-  if (real == 0.) {
-    *ip = 0.;
-    return (0.);
-  }
+       if (real == 0.) {
+               *ip = 0.;
+               return (0.);
+       }
 
 /* negative number ? */
-  if (real < 0.)
-    real = -real;
+       if (real < 0.)
+               real = -real;
 
 /* a fraction ? */
-  if ( real < 1.) {
-    *ip = 0.;
-    return real;
-  }
+       if ( real < 1.) {
+               *ip = 0.;
+               return real;
+       }
 /* the real work :-) */
-  for (j = log_10(real); j >= 0; j--) {
-    p = pow_10(j);
-    s = (real - real_integral)/p;
-    i = 0.;
-    while (i + 1. <= s) {i++;}
-    real_integral += i*p;
-  }
-  *ip = real_integral;
-  return (real - real_integral);
+       for (j = log_10(real); j >= 0; j--) {
+               p = pow_10(j);
+               s = (real - real_integral)/p;
+               i = 0.;
+               while (i + 1. <= s) {i++;}
+               real_integral += i*p;
+       }
+       *ip = real_integral;
+       return (real - real_integral);
 }
 
 #define PRECISION 1.e-6
@@ -171,76 +171,76 @@ int precision;
 char ** fract;
 #endif
 {
-  register int i, j;
-  double ip, fp; /* integer and fraction part */
-  double fraction;
-  int digits = MAX_INT - 1;
-  static char integral_part[MAX_INT];
-  static char fraction_part[MAX_FRACT];
-  double sign;
-  int ch;
+       register int i, j;
+       double ip, fp; /* integer and fraction part */
+       double fraction;
+       int digits = MAX_INT - 1;
+       static char integral_part[MAX_INT];
+       static char fraction_part[MAX_FRACT];
+       double sign;
+       int ch;
 
 /* taking care of the obvious case: 0.0 */
-  if (number == 0.) {
-    integral_part[0] = '0';
-    integral_part[1] = '\0';
-    fraction_part[0] = '0';
-    fraction_part[1] = '\0';
-    return integral_part;
-  }
+       if (number == 0.) {
+               integral_part[0] = '0';
+               integral_part[1] = '\0';
+               fraction_part[0] = '0';
+               fraction_part[1] = '\0';
+               return integral_part;
+       }
 
 /* for negative numbers */
-  if ((sign = number) < 0.) {
-    number = -number;
-    digits--; /* sign consume one digit */
-  }
+       if ((sign = number) < 0.) {
+               number = -number;
+               digits--; /* sign consume one digit */
+       }
 
-  fraction = integral(number, &ip);
-  number = ip;
+       fraction = integral(number, &ip);
+       number = ip;
 /* do the integral part */
-  if ( ip == 0.) {
-    integral_part[0] = '0';
-    i = 1;
-  } else {
-    for ( i = 0; i < digits && number != 0.; ++i) {
-      number /= base;
-      fp = integral(number, &ip);
-      ch = (int)((fp + PRECISION)*base); /* force to round */
-      integral_part[i] = (ch <= 9) ? ch + '0' : ch + 'a' - 10;
-      if (! isxdigit(integral_part[i])) /* bail out overflow !! */
+       if ( ip == 0.) {
+               integral_part[0] = '0';
+               i = 1;
+       } else {
+               for ( i = 0; i < digits && number != 0.; ++i) {
+                       number /= base;
+                       fp = integral(number, &ip);
+                       ch = (int)((fp + PRECISION)*base); /* force to round */
+                       integral_part[i] = (ch <= 9) ? ch + '0' : ch + 'a' - 10;
+                       if (! isxdigit(integral_part[i])) /* bail out overflow !! */
        break;
-      number = ip;
-     }
-  }
+                       number = ip;
+                }
+       }
 
 /* Oh No !! out of bound, ho well fill it up ! */
-  if (number != 0.)
-    for (i = 0; i < digits; ++i)
-      integral_part[i] = '9';
+       if (number != 0.)
+               for (i = 0; i < digits; ++i)
+                       integral_part[i] = '9';
 
 /* put the sign ? */
-  if (sign < 0.)
-    integral_part[i++] = '-';
+       if (sign < 0.)
+               integral_part[i++] = '-';
 
-  integral_part[i] = '\0';
+       integral_part[i] = '\0';
 
 /* reverse every thing */
-  for ( i--, j = 0; j < i; j++, i--)
-    SWAP_INT(integral_part[i], integral_part[j]);
+       for ( i--, j = 0; j < i; j++, i--)
+               SWAP_INT(integral_part[i], integral_part[j]);
 
 /* the fractionnal part */
-  for (i=0, fp=fraction; precision > 0 && i < MAX_FRACT ; i++, precision--     ) {
-    fraction_part[i] = (int)((fp + PRECISION)*10. + '0');
-    if (! isdigit(fraction_part[i])) /* underflow ? */
-      break;
-    fp = (fp*10.0) - (double)(long)((fp + PRECISION)*10.);
-  }
-  fraction_part[i] = '\0';
+       for (i=0, fp=fraction; precision > 0 && i < MAX_FRACT ; i++, precision--        ) {
+               fraction_part[i] = (int)((fp + PRECISION)*10. + '0');
+               if (! isdigit(fraction_part[i])) /* underflow ? */
+                       break;
+               fp = (fp*10.0) - (double)(long)((fp + PRECISION)*10.);
+       }
+       fraction_part[i] = '\0';
 
-  if (fract != (char **)0)
-    *fract = fraction_part;
+       if (fract != (char **)0)
+               *fract = fraction_part;
 
-  return integral_part;
+       return integral_part;
 
 }
 
@@ -256,18 +256,18 @@ struct DATA *p;
 double d;
 #endif
 {
-  char *tmp;
-
-  tmp = itoa(d);
-  p->width -= strlen(tmp);
-  PAD_RIGHT(p);
-  PUT_PLUS(d, p);
-  PUT_SPACE(d, p);
-  while (*tmp) { /* the integral */
-    PUT_CHAR(*tmp, p);
-    tmp++;
-  }
-  PAD_LEFT(p);
+       char *tmp;
+
+       tmp = itoa(d);
+       p->width -= strlen(tmp);
+       PAD_RIGHT(p);
+       PUT_PLUS(d, p);
+       PUT_SPACE(d, p);
+       while (*tmp) { /* the integral */
+               PUT_CHAR(*tmp, p);
+               tmp++;
+       }
+       PAD_LEFT(p);
 }
 
 /* for %o octal representation */
@@ -280,18 +280,18 @@ struct DATA *p;
 double d;
 #endif
 {
-  char *tmp;
-
-  tmp = otoa(d);
-  p->width -= strlen(tmp);
-  PAD_RIGHT(p);
-  if (p->square == FOUND) /* had prefix '0' for octal */
-    PUT_CHAR('0', p);
-  while (*tmp) { /* octal */
-    PUT_CHAR(*tmp, p);
-    tmp++;
-  }
-  PAD_LEFT(p);
+       char *tmp;
+
+       tmp = otoa(d);
+       p->width -= strlen(tmp);
+       PAD_RIGHT(p);
+       if (p->square == FOUND) /* had prefix '0' for octal */
+               PUT_CHAR('0', p);
+       while (*tmp) { /* octal */
+               PUT_CHAR(*tmp, p);
+               tmp++;
+       }
+       PAD_LEFT(p);
 }
 
 /* for %x %X hexadecimal representation */
@@ -304,19 +304,19 @@ struct DATA *p;
 double d;
 #endif
 {
-  char *tmp;
-
-  tmp = htoa(d);
-  p->width -= strlen(tmp);
-  PAD_RIGHT(p);
-  if (p->square == FOUND) { /* prefix '0x' for hexa */
-    PUT_CHAR('0', p); PUT_CHAR(*p->pf, p);
-  }
-  while (*tmp) { /* hexa */
-    PUT_CHAR((*p->pf == 'X' ? toupper(*tmp) : *tmp), p);
-    tmp++;
-  }
-  PAD_LEFT(p);
+       char *tmp;
+
+       tmp = htoa(d);
+       p->width -= strlen(tmp);
+       PAD_RIGHT(p);
+       if (p->square == FOUND) { /* prefix '0x' for hexa */
+               PUT_CHAR('0', p); PUT_CHAR(*p->pf, p);
+       }
+       while (*tmp) { /* hexa */
+               PUT_CHAR((*p->pf == 'X' ? toupper(*tmp) : *tmp), p);
+               tmp++;
+       }
+       PAD_LEFT(p);
 }
 
 /* %s strings */
@@ -329,21 +329,21 @@ struct DATA *p;
 char *tmp;
 #endif
 {
-  int i;
-
-  i = strlen(tmp);
-  if (p->precision != NOT_FOUND) /* the smallest number */
-    i = (i < p->precision ? i : p->precision);
-  p->width -= i;
-  PAD_RIGHT(p);
-  while (i-- > 0) { /* put the sting */
-    PUT_CHAR(*tmp, p);
-    tmp++;
-  }
-  PAD_LEFT(p);
+       int i;
+
+       i = strlen(tmp);
+       if (p->precision != NOT_FOUND) /* the smallest number */
+               i = (i < p->precision ? i : p->precision);
+       p->width -= i;
+       PAD_RIGHT(p);
+       while (i-- > 0) { /* put the sting */
+               PUT_CHAR(*tmp, p);
+               tmp++;
+       }
+       PAD_LEFT(p);
 }
 
-/* %f or %g  floating point representation */
+/* %f or %g    floating point representation */
 PRIVATE void
 #ifdef __STDC__
 floating(struct DATA *p, double d)
@@ -353,33 +353,33 @@ struct DATA *p;
 double d;
 #endif
 {
-  char *tmp, *tmp2;
-  int i;
-
-  DEF_PREC(p);
-  d = ROUND(d, p);
-  tmp = dtoa(d, p->precision, &tmp2);
-  /* calculate the padding. 1 for the dot */
-  p->width = p->width -
-           ((d > 0. && p->justify == RIGHT) ? 1:0) -
-           ((p->space == FOUND) ? 1:0) -
-           strlen(tmp) - p->precision - 1;
-  PAD_RIGHT(p);
-  PUT_PLUS(d, p);
-  PUT_SPACE(d, p);
-  while (*tmp) { /* the integral */
-    PUT_CHAR(*tmp, p);
-    tmp++;
-  }
-  if (p->precision != 0 || p->square == FOUND)
-    PUT_CHAR('.', p);  /* put the '.' */
-  if (*p->pf == 'g' || *p->pf == 'G') /* smash the trailing zeros */
-    for (i = strlen(tmp2) - 1; i >= 0 && tmp2[i] == '0'; i--)
-       tmp2[i] = '\0';
-  for (; *tmp2; tmp2++)
-    PUT_CHAR(*tmp2, p); /* the fraction */
-
-  PAD_LEFT(p);
+       char *tmp, *tmp2;
+       int i;
+
+       DEF_PREC(p);
+       d = ROUND(d, p);
+       tmp = dtoa(d, p->precision, &tmp2);
+       /* calculate the padding. 1 for the dot */
+       p->width = p->width -
+                       ((d > 0. && p->justify == RIGHT) ? 1:0) -
+                       ((p->space == FOUND) ? 1:0) -
+                       strlen(tmp) - p->precision - 1;
+       PAD_RIGHT(p);
+       PUT_PLUS(d, p);
+       PUT_SPACE(d, p);
+       while (*tmp) { /* the integral */
+               PUT_CHAR(*tmp, p);
+               tmp++;
+       }
+       if (p->precision != 0 || p->square == FOUND)
+               PUT_CHAR('.', p);       /* put the '.' */
+       if (*p->pf == 'g' || *p->pf == 'G') /* smash the trailing zeros */
+               for (i = strlen(tmp2) - 1; i >= 0 && tmp2[i] == '0'; i--)
+                        tmp2[i] = '\0';
+       for (; *tmp2; tmp2++)
+               PUT_CHAR(*tmp2, p); /* the fraction */
+
+       PAD_LEFT(p);
 }
 
 /* %e %E %g exponent representation */
@@ -392,55 +392,55 @@ struct DATA *p;
 double d;
 #endif
 {
-  char *tmp, *tmp2;
-  int j, i;
-
-  DEF_PREC(p);
-  j = log_10(d);
-  d = d / pow_10(j);  /* get the Mantissa */
-  d = ROUND(d, p);
-  tmp = dtoa(d, p->precision, &tmp2);
-  /* 1 for unit, 1 for the '.', 1 for 'e|E',
-   * 1 for '+|-', 3 for 'exp' */
-  /* calculate how much padding need */
-  p->width = p->width -
-            ((d > 0. && p->justify == RIGHT) ? 1:0) -
-            ((p->space == FOUND) ? 1:0) - p->precision - 7;
-  PAD_RIGHT(p);
-  PUT_PLUS(d, p);
-  PUT_SPACE(d, p);
-  while (*tmp) {/* the integral */
-    PUT_CHAR(*tmp, p);
-    tmp++;
-  }
-  if (p->precision != 0 || p->square == FOUND)
-    PUT_CHAR('.', p);  /* the '.' */
-  if (*p->pf == 'g' || *p->pf == 'G') /* smash the trailing zeros */
-    for (i = strlen(tmp2) - 1; i >= 0 && tmp2[i] == '0'; i--)
-       tmp2[i] = '\0';
-  for (; *tmp2; tmp2++)
-    PUT_CHAR(*tmp2, p); /* the fraction */
-
-  if (*p->pf == 'g' || *p->pf == 'e') { /* the exponent put the 'e|E' */
-    PUT_CHAR('e', p);
-  } else
-    PUT_CHAR('E', p);
-  if (j >= 0) {  /* the sign of the exp */
-    PUT_CHAR('+', p);
-  } else {
-    PUT_CHAR('-', p);
-    j = -j;
-  }
-  tmp = itoa((double)j);
-  if (j < 9) {  /* need to pad the exponent with 0 '000' */
-    PUT_CHAR('0', p); PUT_CHAR('0', p);
-  } else if (j < 99)
-    PUT_CHAR('0', p);
-  while (*tmp) { /* the exponent */
-    PUT_CHAR(*tmp, p);
-    tmp++;
-  }
-  PAD_LEFT(p);
+       char *tmp, *tmp2;
+       int j, i;
+
+       DEF_PREC(p);
+       j = log_10(d);
+       d = d / pow_10(j);      /* get the Mantissa */
+       d = ROUND(d, p);
+       tmp = dtoa(d, p->precision, &tmp2);
+       /* 1 for unit, 1 for the '.', 1 for 'e|E',
+        * 1 for '+|-', 3 for 'exp' */
+       /* calculate how much padding need */
+       p->width = p->width -
+                        ((d > 0. && p->justify == RIGHT) ? 1:0) -
+                        ((p->space == FOUND) ? 1:0) - p->precision - 7;
+       PAD_RIGHT(p);
+       PUT_PLUS(d, p);
+       PUT_SPACE(d, p);
+       while (*tmp) {/* the integral */
+               PUT_CHAR(*tmp, p);
+               tmp++;
+       }
+       if (p->precision != 0 || p->square == FOUND)
+               PUT_CHAR('.', p);       /* the '.' */
+       if (*p->pf == 'g' || *p->pf == 'G') /* smash the trailing zeros */
+               for (i = strlen(tmp2) - 1; i >= 0 && tmp2[i] == '0'; i--)
+                        tmp2[i] = '\0';
+       for (; *tmp2; tmp2++)
+               PUT_CHAR(*tmp2, p); /* the fraction */
+
+       if (*p->pf == 'g' || *p->pf == 'e') { /* the exponent put the 'e|E' */
+               PUT_CHAR('e', p);
+       } else
+               PUT_CHAR('E', p);
+       if (j >= 0) {   /* the sign of the exp */
+               PUT_CHAR('+', p);
+       } else {
+               PUT_CHAR('-', p);
+               j = -j;
+       }
+       tmp = itoa((double)j);
+       if (j < 9) {    /* need to pad the exponent with 0 '000' */
+               PUT_CHAR('0', p); PUT_CHAR('0', p);
+       } else if (j < 99)
+               PUT_CHAR('0', p);
+       while (*tmp) { /* the exponent */
+               PUT_CHAR(*tmp, p);
+               tmp++;
+       }
+       PAD_LEFT(p);
 }
 
 /* initialize the conversion specifiers */
@@ -453,47 +453,47 @@ char * s;
 struct DATA * p;
 #endif
 {
-  char number[MAX_FIELD/2];
-  int i;
-
-  /* reset the flags.  */
-  p->precision = p->width = NOT_FOUND;
-  p->star_w = p->star_p = NOT_FOUND;
-  p->square = p->space = NOT_FOUND;
-  p->a_long = p->justify = NOT_FOUND;
-  p->a_longlong = NOT_FOUND;
-  p->pad = ' ';
-
-  for(;s && *s ;s++) {
-    switch(*s) {
-      case ' ': p->space = FOUND; break;
-      case '#': p->square = FOUND; break;
-      case '*': if (p->width == NOT_FOUND)
-                 p->width = p->star_w = FOUND;
+       char number[MAX_FIELD/2];
+       int i;
+
+       /* reset the flags.     */
+       p->precision = p->width = NOT_FOUND;
+       p->star_w = p->star_p = NOT_FOUND;
+       p->square = p->space = NOT_FOUND;
+       p->a_long = p->justify = NOT_FOUND;
+       p->a_longlong = NOT_FOUND;
+       p->pad = ' ';
+
+       for(;s && *s ;s++) {
+               switch(*s) {
+                       case ' ': p->space = FOUND; break;
+                       case '#': p->square = FOUND; break;
+                       case '*': if (p->width == NOT_FOUND)
+                       p->width = p->star_w = FOUND;
                else
-                 p->precision = p->star_p = FOUND;
+                       p->precision = p->star_p = FOUND;
                break;
-      case '+': p->justify = RIGHT; break;
-      case '-': p->justify = LEFT; break;
-      case '.': if (p->width == NOT_FOUND)
-                 p->width = 0;
+                       case '+': p->justify = RIGHT; break;
+                       case '-': p->justify = LEFT; break;
+                       case '.': if (p->width == NOT_FOUND)
+                       p->width = 0;
                break;
-      case '0': p->pad = '0'; break;
-      case '1': case '2': case '3':
-      case '4': case '5': case '6':
-      case '7': case '8': case '9':     /* gob all the digits */
+                       case '0': p->pad = '0'; break;
+                       case '1': case '2': case '3':
+                       case '4': case '5': case '6':
+                       case '7': case '8': case '9':            /* gob all the digits */
        for (i = 0; isdigit(*s); i++, s++)
-         if (i < MAX_FIELD/2 - 1)
-           number[i] = *s;
+               if (i < MAX_FIELD/2 - 1)
+                       number[i] = *s;
        number[i] = '\0';
        if (p->width == NOT_FOUND)
-         p->width = atoi(number);
+               p->width = atoi(number);
        else
-         p->precision = atoi(number);
-       s--;   /* went to far go back */
+               p->precision = atoi(number);
+       s--;     /* went to far go back */
        break;
-    }
-  }
+               }
+       }
 }
 
 PUBLIC int
@@ -507,172 +507,172 @@ char * format;
 va_list args;
 #endif
 {
-  struct DATA data;
-  char conv_field[MAX_FIELD];
-  double d; /* temporary holder */
-  int state;
-  int i;
+       struct DATA data;
+       char conv_field[MAX_FIELD];
+       double d; /* temporary holder */
+       int state;
+       int i;
 
-  data.length = length - 1; /* leave room for '\0' */
-  data.holder = string;
-  data.pf = format;
-  data.counter = 0;
+       data.length = length - 1; /* leave room for '\0' */
+       data.holder = string;
+       data.pf = format;
+       data.counter = 0;
 
 
 /* sanity check, the string must be > 1 */
-  if (length < 1)
-    return -1;
+       if (length < 1)
+               return -1;
 
 
-  for (; *data.pf && (data.counter < data.length); data.pf++) {
-    if ( *data.pf == '%' ) { /* we got a magic % cookie */
-      conv_flag((char *)0, &data); /* initialise format flags */
-      for (state = 1; *data.pf && state;) {
+       for (; *data.pf && (data.counter < data.length); data.pf++) {
+               if ( *data.pf == '%' ) { /* we got a magic % cookie */
+                       conv_flag((char *)0, &data); /* initialise format flags */
+                       for (state = 1; *data.pf && state;) {
        switch (*(++data.pf)) {
-         case '\0': /* a NULL here ? ? bail out */
-           *data.holder = '\0';
-           return data.counter;
-           break;
-         case 'f':  /* float, double */
-           STAR_ARGS(&data);
-           if (data.a_long == FOUND)
-              d = va_arg(args, LONG_DOUBLE);
-           else
-              d = va_arg(args, double);
-           floating(&data, d);
-           state = 0;
-           break;
-         case 'g':
-         case 'G':
-           STAR_ARGS(&data);
-           DEF_PREC(&data);
-           if (data.a_long == FOUND)
-              d = va_arg(args, LONG_DOUBLE);
-           else
-              d = va_arg(args, double);
-           i = log_10(d);
-           /*
-            * for '%g|%G' ANSI: use f if exponent
-            * is in the range or [-4,p] exclusively
-            * else use %e|%E
-            */
-           if (-4 < i && i < data.precision)
-             floating(&data, d);
-           else
-             exponent(&data, d);
-           state = 0;
-           break;
-         case 'e':
-         case 'E':  /* Exponent double */
-           STAR_ARGS(&data);
-           if (data.a_long == FOUND)
-              d = va_arg(args, LONG_DOUBLE);
-           else
-              d = va_arg(args, double);
-           exponent(&data, d);
-           state = 0;
-           break;
-         case 'u':  /* unsigned decimal */
-           STAR_ARGS(&data);
-           if (data.a_longlong == FOUND)
-             d = va_arg(args, unsigned LONG_LONG);
-           else if (data.a_long == FOUND)
-             d = va_arg(args, unsigned long);
-           else
-             d = va_arg(args, unsigned int);
-           decimal(&data, d);
-           state = 0;
-           break;
-         case 'd':  /* decimal */
-           STAR_ARGS(&data);
-           if (data.a_longlong == FOUND)
-             d = va_arg(args, LONG_LONG);
-           else if (data.a_long == FOUND)
-             d = va_arg(args, long);
-           else
-             d = va_arg(args, int);
-           decimal(&data, d);
-           state = 0;
-           break;
-         case 'o':  /* octal */
-           STAR_ARGS(&data);
-           if (data.a_longlong == FOUND)
-             d = va_arg(args, LONG_LONG);
-           else if (data.a_long == FOUND)
-             d = va_arg(args, long);
-           else
-             d = va_arg(args, int);
-           octal(&data, d);
-           state = 0;
-           break;
-         case 'x':
-         case 'X':  /* hexadecimal */
-           STAR_ARGS(&data);
-           if (data.a_longlong == FOUND)
-             d = va_arg(args, LONG_LONG);
-           else if (data.a_long == FOUND)
-             d = va_arg(args, long);
-           else
-             d = va_arg(args, int);
-           hexa(&data, d);
-           state = 0;
-           break;
-         case 'c': /* character */
-           d = va_arg(args, int);
-           PUT_CHAR(d, &data);
-           state = 0;
-           break;
-         case 's':  /* string */
-           STAR_ARGS(&data);
-           strings(&data, va_arg(args, char *));
-           state = 0;
-           break;
-         case 'n':
-           *(va_arg(args, int *)) = data.counter; /* what's the count ? */
-           state = 0;
-           break;
-         case 'q':
-           data.a_longlong = FOUND;
-           break;
-         case 'L':
-         case 'l':
-           if (data.a_long == FOUND)
-             data.a_longlong = FOUND;
-           else
-             data.a_long = FOUND;
-           break;
-         case 'h':
-           break;
-         case '%':  /* nothing just % */
-           PUT_CHAR('%', &data);
-           state = 0;
-           break;
-         case '#': case ' ': case '+': case '*':
-         case '-': case '.': case '0': case '1':
-         case '2': case '3': case '4': case '5':
-         case '6': case '7': case '8': case '9':
-          /* initialize width and precision */
-           for (i = 0; isflag(*data.pf); i++, data.pf++)
-             if (i < MAX_FIELD - 1)
+               case '\0': /* a NULL here ? ? bail out */
+                       *data.holder = '\0';
+                       return data.counter;
+                       break;
+               case 'f':       /* float, double */
+                       STAR_ARGS(&data);
+                       if (data.a_long == FOUND)
+                                d = va_arg(args, LONG_DOUBLE);
+                       else
+                                d = va_arg(args, double);
+                       floating(&data, d);
+                       state = 0;
+                       break;
+               case 'g':
+               case 'G':
+                       STAR_ARGS(&data);
+                       DEF_PREC(&data);
+                       if (data.a_long == FOUND)
+                                d = va_arg(args, LONG_DOUBLE);
+                       else
+                                d = va_arg(args, double);
+                       i = log_10(d);
+                       /*
+                        * for '%g|%G' ANSI: use f if exponent
+                        * is in the range or [-4,p] exclusively
+                        * else use %e|%E
+                        */
+                       if (-4 < i && i < data.precision)
+                               floating(&data, d);
+                       else
+                               exponent(&data, d);
+                       state = 0;
+                       break;
+               case 'e':
+               case 'E':       /* Exponent double */
+                       STAR_ARGS(&data);
+                       if (data.a_long == FOUND)
+                                d = va_arg(args, LONG_DOUBLE);
+                       else
+                                d = va_arg(args, double);
+                       exponent(&data, d);
+                       state = 0;
+                       break;
+               case 'u':       /* unsigned decimal */
+                       STAR_ARGS(&data);
+                       if (data.a_longlong == FOUND)
+                               d = va_arg(args, unsigned LONG_LONG);
+                       else if (data.a_long == FOUND)
+                               d = va_arg(args, unsigned long);
+                       else
+                               d = va_arg(args, unsigned int);
+                       decimal(&data, d);
+                       state = 0;
+                       break;
+               case 'd':       /* decimal */
+                       STAR_ARGS(&data);
+                       if (data.a_longlong == FOUND)
+                               d = va_arg(args, LONG_LONG);
+                       else if (data.a_long == FOUND)
+                               d = va_arg(args, long);
+                       else
+                               d = va_arg(args, int);
+                       decimal(&data, d);
+                       state = 0;
+                       break;
+               case 'o':       /* octal */
+                       STAR_ARGS(&data);
+                       if (data.a_longlong == FOUND)
+                               d = va_arg(args, LONG_LONG);
+                       else if (data.a_long == FOUND)
+                               d = va_arg(args, long);
+                       else
+                               d = va_arg(args, int);
+                       octal(&data, d);
+                       state = 0;
+                       break;
+               case 'x':
+               case 'X':       /* hexadecimal */
+                       STAR_ARGS(&data);
+                       if (data.a_longlong == FOUND)
+                               d = va_arg(args, LONG_LONG);
+                       else if (data.a_long == FOUND)
+                               d = va_arg(args, long);
+                       else
+                               d = va_arg(args, int);
+                       hexa(&data, d);
+                       state = 0;
+                       break;
+               case 'c': /* character */
+                       d = va_arg(args, int);
+                       PUT_CHAR(d, &data);
+                       state = 0;
+                       break;
+               case 's':       /* string */
+                       STAR_ARGS(&data);
+                       strings(&data, va_arg(args, char *));
+                       state = 0;
+                       break;
+               case 'n':
+                       *(va_arg(args, int *)) = data.counter; /* what's the count ? */
+                       state = 0;
+                       break;
+               case 'q':
+                       data.a_longlong = FOUND;
+                       break;
+               case 'L':
+               case 'l':
+                       if (data.a_long == FOUND)
+                               data.a_longlong = FOUND;
+                       else
+                               data.a_long = FOUND;
+                       break;
+               case 'h':
+                       break;
+               case '%':       /* nothing just % */
+                       PUT_CHAR('%', &data);
+                       state = 0;
+                       break;
+               case '#': case ' ': case '+': case '*':
+               case '-': case '.': case '0': case '1':
+               case '2': case '3': case '4': case '5':
+               case '6': case '7': case '8': case '9':
+                /* initialize width and precision */
+                       for (i = 0; isflag(*data.pf); i++, data.pf++)
+                               if (i < MAX_FIELD - 1)
                conv_field[i] = *data.pf;
-           conv_field[i] = '\0';
-           conv_flag(conv_field, &data);
-           data.pf--;   /* went to far go back */
-           break;
-         default:
-           /* is this an error ? maybe bail out */
-           state = 0;
-           break;
+                       conv_field[i] = '\0';
+                       conv_flag(conv_field, &data);
+                       data.pf--;       /* went to far go back */
+                       break;
+               default:
+                       /* is this an error ? maybe bail out */
+                       state = 0;
+                       break;
        } /* end switch */
-      } /* end of for state */
-    } else { /* not % */
-      PUT_CHAR(*data.pf, &data);  /* add the char the string */
-    }
-  }
+                       } /* end of for state */
+               } else { /* not % */
+                       PUT_CHAR(*data.pf, &data);      /* add the char the string */
+               }
+       }
 
-  *data.holder = '\0'; /* the end ye ! */
+       *data.holder = '\0'; /* the end ye ! */
 
-  return data.counter;
+       return data.counter;
 }
 
 #endif /* HAVE_VSNPRINTF */
@@ -690,20 +690,20 @@ char * format;
 va_dcl
 #endif
 {
-  int rval;
-  va_list args;
+       int rval;
+       va_list args;
 
 #if __STDC__
-  va_start(args, format);
+       va_start(args, format);
 #else
-  va_start(args);
+       va_start(args);
 #endif
 
-  rval = vsnprintf (string, length, format, args);
+       rval = vsnprintf (string, length, format, args);
 
-  va_end(args);
+       va_end(args);
 
-  return rval;
+       return rval;
 }
 
 #endif /* HAVE_SNPRINTF */
@@ -716,165 +716,165 @@ va_dcl
 /* set of small tests for snprintf() */
 int main()
 {
-  char holder[100];
-  int i;
+       char holder[100];
+       int i;
 
 /*
-  printf("Suite of test for snprintf:\n");
-  printf("a_format\n");
-  printf("printf() format\n");
-  printf("snprintf() format\n\n");
+       printf("Suite of test for snprintf:\n");
+       printf("a_format\n");
+       printf("printf() format\n");
+       printf("snprintf() format\n\n");
 */
 /* Checking the field widths */
 
-  printf("/%%d/, 336\n");
-  snprintf(holder, sizeof holder, "/%d/\n", 336);
-  printf("/%d/\n", 336);
-  printf("%s\n", holder);
+       printf("/%%d/, 336\n");
+       snprintf(holder, sizeof holder, "/%d/\n", 336);
+       printf("/%d/\n", 336);
+       printf("%s\n", holder);
 
-  printf("/%%2d/, 336\n");
-  snprintf(holder, sizeof holder, "/%2d/\n", 336);
-  printf("/%2d/\n", 336);
-  printf("%s\n", holder);
+       printf("/%%2d/, 336\n");
+       snprintf(holder, sizeof holder, "/%2d/\n", 336);
+       printf("/%2d/\n", 336);
+       printf("%s\n", holder);
 
-  printf("/%%10d/, 336\n");
-  snprintf(holder, sizeof holder, "/%10d/\n", 336);
-  printf("/%10d/\n", 336);
-  printf("%s\n", holder);
+       printf("/%%10d/, 336\n");
+       snprintf(holder, sizeof holder, "/%10d/\n", 336);
+       printf("/%10d/\n", 336);
+       printf("%s\n", holder);
 
-  printf("/%%-10d/, 336\n");
-  snprintf(holder, sizeof holder, "/%-10d/\n", 336);
-  printf("/%-10d/\n", 336);
-  printf("%s\n", holder);
+       printf("/%%-10d/, 336\n");
+       snprintf(holder, sizeof holder, "/%-10d/\n", 336);
+       printf("/%-10d/\n", 336);
+       printf("%s\n", holder);
 
-/* long long  */
+/* long long   */
 
-  printf("/%%lld/, 336\n");
-  snprintf(holder, sizeof holder, "/%lld/\n", (LONG_LONG)336);
-  printf("/%lld/\n", (LONG_LONG)336);
-  printf("%s\n", holder);
+       printf("/%%lld/, 336\n");
+       snprintf(holder, sizeof holder, "/%lld/\n", (LONG_LONG)336);
+       printf("/%lld/\n", (LONG_LONG)336);
+       printf("%s\n", holder);
 
-  printf("/%%2qd/, 336\n");
-  snprintf(holder, sizeof holder, "/%2qd/\n", (LONG_LONG)336);
-  printf("/%2qd/\n", (LONG_LONG)336);
-  printf("%s\n", holder);
+       printf("/%%2qd/, 336\n");
+       snprintf(holder, sizeof holder, "/%2qd/\n", (LONG_LONG)336);
+       printf("/%2qd/\n", (LONG_LONG)336);
+       printf("%s\n", holder);
 
 /* floating points */
 
-  printf("/%%f/, 1234.56\n");
-  snprintf(holder, sizeof holder, "/%f/\n", 1234.56);
-  printf("/%f/\n", 1234.56);
-  printf("%s\n", holder);
-
-  printf("/%%e/, 1234.56\n");
-  snprintf(holder, sizeof holder, "/%e/\n", 1234.56);
-  printf("/%e/\n", 1234.56);
-  printf("%s\n", holder);
-
-  printf("/%%4.2f/, 1234.56\n");
-  snprintf(holder, sizeof holder, "/%4.2f/\n", 1234.56);
-  printf("/%4.2f/\n", 1234.56);
-  printf("%s\n", holder);
-
-  printf("/%%3.1f/, 1234.56\n");
-  snprintf(holder, sizeof holder, "/%3.1f/\n", 1234.56);
-  printf("/%3.1f/\n", 1234.56);
-  printf("%s\n", holder);
-
-  printf("/%%10.3f/, 1234.56\n");
-  snprintf(holder, sizeof holder, "/%10.3f/\n", 1234.56);
-  printf("/%10.3f/\n", 1234.56);
-  printf("%s\n", holder);
-
-  printf("/%%10.3e/, 1234.56\n");
-  snprintf(holder, sizeof holder, "/%10.3e/\n", 1234.56);
-  printf("/%10.3e/\n", 1234.56);
-  printf("%s\n", holder);
-
-  printf("/%%+4.2f/, 1234.56\n");
-  snprintf(holder, sizeof holder, "/%+4.2f/\n", 1234.56);
-  printf("/%+4.2f/\n", 1234.56);
-  printf("%s\n", holder);
-
-  printf("/%%010.2f/, 1234.56\n");
-  snprintf(holder, sizeof holder, "/%010.2f/\n", 1234.56);
-  printf("/%010.2f/\n", 1234.56);
-  printf("%s\n", holder);
+       printf("/%%f/, 1234.56\n");
+       snprintf(holder, sizeof holder, "/%f/\n", 1234.56);
+       printf("/%f/\n", 1234.56);
+       printf("%s\n", holder);
+
+       printf("/%%e/, 1234.56\n");
+       snprintf(holder, sizeof holder, "/%e/\n", 1234.56);
+       printf("/%e/\n", 1234.56);
+       printf("%s\n", holder);
+
+       printf("/%%4.2f/, 1234.56\n");
+       snprintf(holder, sizeof holder, "/%4.2f/\n", 1234.56);
+       printf("/%4.2f/\n", 1234.56);
+       printf("%s\n", holder);
+
+       printf("/%%3.1f/, 1234.56\n");
+       snprintf(holder, sizeof holder, "/%3.1f/\n", 1234.56);
+       printf("/%3.1f/\n", 1234.56);
+       printf("%s\n", holder);
+
+       printf("/%%10.3f/, 1234.56\n");
+       snprintf(holder, sizeof holder, "/%10.3f/\n", 1234.56);
+       printf("/%10.3f/\n", 1234.56);
+       printf("%s\n", holder);
+
+       printf("/%%10.3e/, 1234.56\n");
+       snprintf(holder, sizeof holder, "/%10.3e/\n", 1234.56);
+       printf("/%10.3e/\n", 1234.56);
+       printf("%s\n", holder);
+
+       printf("/%%+4.2f/, 1234.56\n");
+       snprintf(holder, sizeof holder, "/%+4.2f/\n", 1234.56);
+       printf("/%+4.2f/\n", 1234.56);
+       printf("%s\n", holder);
+
+       printf("/%%010.2f/, 1234.56\n");
+       snprintf(holder, sizeof holder, "/%010.2f/\n", 1234.56);
+       printf("/%010.2f/\n", 1234.56);
+       printf("%s\n", holder);
 
 #define BLURB "Outstanding acting !"
 /* strings precisions */
 
-  printf("/%%2s/, \"%s\"\n", BLURB);
-  snprintf(holder, sizeof holder, "/%2s/\n", BLURB);
-  printf("/%2s/\n", BLURB);
-  printf("%s\n", holder);
+       printf("/%%2s/, \"%s\"\n", BLURB);
+       snprintf(holder, sizeof holder, "/%2s/\n", BLURB);
+       printf("/%2s/\n", BLURB);
+       printf("%s\n", holder);
 
-  printf("/%%22s/ %s\n", BLURB);
-  snprintf(holder, sizeof holder, "/%22s/\n", BLURB);
-  printf("/%22s/\n", BLURB);
-  printf("%s\n", holder);
+       printf("/%%22s/ %s\n", BLURB);
+       snprintf(holder, sizeof holder, "/%22s/\n", BLURB);
+       printf("/%22s/\n", BLURB);
+       printf("%s\n", holder);
 
-  printf("/%%22.5s/ %s\n", BLURB);
-  snprintf(holder, sizeof holder, "/%22.5s/\n", BLURB);
-  printf("/%22.5s/\n", BLURB);
-  printf("%s\n", holder);
+       printf("/%%22.5s/ %s\n", BLURB);
+       snprintf(holder, sizeof holder, "/%22.5s/\n", BLURB);
+       printf("/%22.5s/\n", BLURB);
+       printf("%s\n", holder);
 
-  printf("/%%-22.5s/ %s\n", BLURB);
-  snprintf(holder, sizeof holder, "/%-22.5s/\n", BLURB);
-  printf("/%-22.5s/\n", BLURB);
-  printf("%s\n", holder);
+       printf("/%%-22.5s/ %s\n", BLURB);
+       snprintf(holder, sizeof holder, "/%-22.5s/\n", BLURB);
+       printf("/%-22.5s/\n", BLURB);
+       printf("%s\n", holder);
 
 /* see some flags */
 
-  printf("%%x %%X %%#x, 31, 31, 31\n");
-  snprintf(holder, sizeof holder, "%x %X %#x\n", 31, 31, 31);
-  printf("%x %X %#x\n", 31, 31, 31);
-  printf("%s\n", holder);
+       printf("%%x %%X %%#x, 31, 31, 31\n");
+       snprintf(holder, sizeof holder, "%x %X %#x\n", 31, 31, 31);
+       printf("%x %X %#x\n", 31, 31, 31);
+       printf("%s\n", holder);
 
-  printf("**%%d**%% d**%% d**, 42, 42, -42\n");
-  snprintf(holder, sizeof holder, "**%d**% d**% d**\n", 42, 42, -42);
-  printf("**%d**% d**% d**\n", 42, 42, -42);
-  printf("%s\n", holder);
+       printf("**%%d**%% d**%% d**, 42, 42, -42\n");
+       snprintf(holder, sizeof holder, "**%d**% d**% d**\n", 42, 42, -42);
+       printf("**%d**% d**% d**\n", 42, 42, -42);
+       printf("%s\n", holder);
 
 /* other flags */
 
-  printf("/%%g/, 31.4\n");
-  snprintf(holder, sizeof holder, "/%g/\n", 31.4);
-  printf("/%g/\n", 31.4);
-  printf("%s\n", holder);
+       printf("/%%g/, 31.4\n");
+       snprintf(holder, sizeof holder, "/%g/\n", 31.4);
+       printf("/%g/\n", 31.4);
+       printf("%s\n", holder);
 
-  printf("/%%.6g/, 31.4\n");
-  snprintf(holder, sizeof holder, "/%.6g/\n", 31.4);
-  printf("/%.6g/\n", 31.4);
-  printf("%s\n", holder);
+       printf("/%%.6g/, 31.4\n");
+       snprintf(holder, sizeof holder, "/%.6g/\n", 31.4);
+       printf("/%.6g/\n", 31.4);
+       printf("%s\n", holder);
 
-  printf("/%%.1G/, 31.4\n");
-  snprintf(holder, sizeof holder, "/%.1G/\n", 31.4);
-  printf("/%.1G/\n", 31.4);
-  printf("%s\n", holder);
+       printf("/%%.1G/, 31.4\n");
+       snprintf(holder, sizeof holder, "/%.1G/\n", 31.4);
+       printf("/%.1G/\n", 31.4);
+       printf("%s\n", holder);
 
-  printf("abc%%n\n");
-  printf("abc%n", &i); printf("%d\n", i);
-  snprintf(holder, sizeof holder, "abc%n", &i);
-  printf("%s", holder); printf("%d\n\n", i);
+       printf("abc%%n\n");
+       printf("abc%n", &i); printf("%d\n", i);
+       snprintf(holder, sizeof holder, "abc%n", &i);
+       printf("%s", holder); printf("%d\n\n", i);
 
-  printf("%%*.*s --> 10.10\n");
-  snprintf(holder, sizeof holder, "%*.*s\n", 10, 10, BLURB);
-  printf("%*.*s\n", 10, 10, BLURB);
-  printf("%s\n", holder);
+       printf("%%*.*s --> 10.10\n");
+       snprintf(holder, sizeof holder, "%*.*s\n", 10, 10, BLURB);
+       printf("%*.*s\n", 10, 10, BLURB);
+       printf("%s\n", holder);
 
-  printf("%%%%%%%%\n");
-  snprintf(holder, sizeof holder, "%%%%\n");
-  printf("%%%%\n");
-  printf("%s\n", holder);
+       printf("%%%%%%%%\n");
+       snprintf(holder, sizeof holder, "%%%%\n");
+       printf("%%%%\n");
+       printf("%s\n", holder);
 
 #define BIG "Hello this is a too big string for the buffer"
-/*  printf("A buffer to small of 10, trying to put this:\n");*/
-  printf("<%%>, %s\n", BIG);
-  i = snprintf(holder, 10, "%s\n", BIG);
-  printf("<%s>\n", BIG);
-  printf("<%s>\n", holder);
+/*     printf("A buffer to small of 10, trying to put this:\n");*/
+       printf("<%%>, %s\n", BIG);
+       i = snprintf(holder, 10, "%s\n", BIG);
+       printf("<%s>\n", BIG);
+       printf("<%s>\n", holder);
 
-  return 0;
+       return 0;
 }
 #endif /* !DRIVER */
index c077603..f159763 100644 (file)
@@ -179,20 +179,20 @@ static FR_TOKEN getthing(char const **ptr, char *buf, int buflen, int tok,
        /* we got SOME form of output string, even if it is empty */
        switch (quote) {
        default:
-         rcode = T_BARE_WORD;
-         break;
+               rcode = T_BARE_WORD;
+               break;
 
        case '\'':
-         rcode = T_SINGLE_QUOTED_STRING;
-         break;
+               rcode = T_SINGLE_QUOTED_STRING;
+               break;
 
        case '"':
-         rcode = T_DOUBLE_QUOTED_STRING;
-         break;
+               rcode = T_DOUBLE_QUOTED_STRING;
+               break;
 
        case '`':
-         rcode = T_BACK_QUOTED_STRING;
-         break;
+               rcode = T_BACK_QUOTED_STRING;
+               break;
        }
 
        return rcode;
index 02271f0..3c2d427 100644 (file)
@@ -859,99 +859,99 @@ void pairmove(TALLOC_CTX *ctx, VALUE_PAIR **to, VALUE_PAIR **from)
                 */
 
                switch (i->op) {
+               /*
+                *      Anything else are operators which
+                *      shouldn't occur.  We ignore them, and
+                *      leave them in place.
+                */
+               default:
+                       tail_from = &(i->next);
+                       continue;
+
+               /*
+                *      Add it to the "to" list, but only if
+                *      it doesn't already exist.
+                */
+               case T_OP_EQ:
+                       found = pairfind(*to, i->da->attr, i->da->vendor, TAG_ANY);
+                       if (!found) goto do_add;
+
+                       tail_from = &(i->next);
+                       continue;
+
+               /*
+                *      Add it to the "to" list, and delete any attribute
+                *      of the same vendor/attr which already exists.
+                */
+               case T_OP_SET:
+                       found = pairfind(*to, i->da->attr, i->da->vendor, TAG_ANY);
+                       if (!found) goto do_add;
+
                        /*
-                        *      Anything else are operators which
-                        *      shouldn't occur.  We ignore them, and
-                        *      leave them in place.
+                        *      Do NOT call pairdelete() here,
+                        *      due to issues with re-writing
+                        *      "request->username".
+                        *
+                        *      Everybody calls pairmove, and
+                        *      expects it to work.  We can't
+                        *      update request->username here,
+                        *      so instead we over-write the
+                        *      vp that it's pointing to.
                         */
+                       switch (found->da->type) {
+                               VALUE_PAIR *j;
+
                        default:
-                               tail_from = &(i->next);
-                               continue;
+                               j = found->next;
+                               memcpy(found, i, sizeof(*found));
+                               found->next = j;
+                               break;
 
-                       /*
-                        *      Add it to the "to" list, but only if
-                        *      it doesn't already exist.
-                        */
-                       case T_OP_EQ:
-                               found = pairfind(*to, i->da->attr, i->da->vendor, TAG_ANY);
-                               if (!found) goto do_add;
+                       case PW_TYPE_TLV:
+                               pairmemsteal(found, i->vp_tlv);
+                               i->vp_tlv = NULL;
+                               break;
+
+                       case PW_TYPE_OCTETS:
+                               pairmemsteal(found, i->vp_octets);
+                               i->vp_octets = NULL;
+                               break;
 
-                               tail_from = &(i->next);
-                               continue;
+                       case PW_TYPE_STRING:
+                               pairstrsteal(found, i->vp_strvalue);
+                               i->vp_strvalue = NULL;
+                               found->tag = i->tag;
+                               break;
+                       }
 
                        /*
-                        *      Add it to the "to" list, and delete any attribute
-                        *      of the same vendor/attr which already exists.
+                        *      Delete *all* of the attributes
+                        *      of the same number.
                         */
-                       case T_OP_SET:
-                               found = pairfind(*to, i->da->attr, i->da->vendor, TAG_ANY);
-                               if (!found) goto do_add;
-
-                               /*
-                                *      Do NOT call pairdelete() here,
-                                *      due to issues with re-writing
-                                *      "request->username".
-                                *
-                                *      Everybody calls pairmove, and
-                                *      expects it to work.  We can't
-                                *      update request->username here,
-                                *      so instead we over-write the
-                                *      vp that it's pointing to.
-                                */
-                               switch (found->da->type) {
-                                       VALUE_PAIR *j;
-
-                                       default:
-                                               j = found->next;
-                                               memcpy(found, i, sizeof(*found));
-                                               found->next = j;
-                                               break;
-
-                                       case PW_TYPE_TLV:
-                                               pairmemsteal(found, i->vp_tlv);
-                                               i->vp_tlv = NULL;
-                                               break;
-
-                                       case PW_TYPE_OCTETS:
-                                               pairmemsteal(found, i->vp_octets);
-                                               i->vp_octets = NULL;
-                                               break;
-
-                                       case PW_TYPE_STRING:
-                                               pairstrsteal(found, i->vp_strvalue);
-                                               i->vp_strvalue = NULL;
-                                               found->tag = i->tag;
-                                               break;
-                               }
-
-                               /*
-                                *      Delete *all* of the attributes
-                                *      of the same number.
-                                */
-                               pairdelete(&found->next,
-                                          found->da->attr,
-                                          found->da->vendor, TAG_ANY);
-
-                               /*
-                                *      Remove this attribute from the
-                                *      "from" list.
-                                */
-                               *tail_from = i->next;
-                               i->next = NULL;
-                               pairfree(&i);
-                               continue;
+                       pairdelete(&found->next,
+                                  found->da->attr,
+                                  found->da->vendor, TAG_ANY);
 
                        /*
-                        *      Move it from the old list and add it
-                        *      to the new list.
+                        *      Remove this attribute from the
+                        *      "from" list.
                         */
-                       case T_OP_ADD:
-               do_add:
-                               *tail_from = i->next;
-                               i->next = NULL;
-                               *tail_new = talloc_steal(ctx, i);
-                               tail_new = &(i->next);
-                               continue;
+                       *tail_from = i->next;
+                       i->next = NULL;
+                       pairfree(&i);
+                       continue;
+
+               /*
+                *      Move it from the old list and add it
+                *      to the new list.
+                */
+               case T_OP_ADD:
+       do_add:
+                       *tail_from = i->next;
+                       i->next = NULL;
+                       *tail_new = talloc_steal(ctx, i);
+                       tail_new = &(i->next);
+                       continue;
                }
        } /* loop over the "from" list. */
 
index 51d9ec2..c82dc66 100644 (file)
@@ -55,29 +55,29 @@ int rad_accounting(REQUEST *request)
 
                result = module_preacct(request);
                switch (result) {
-                       /*
-                        *      The module has a number of OK return codes.
-                        */
-                       case RLM_MODULE_NOOP:
-                       case RLM_MODULE_OK:
-                       case RLM_MODULE_UPDATED:
-                               break;
-                       /*
-                        *      The module handled the request, stop here.
-                        */
-                       case RLM_MODULE_HANDLED:
-                               return result;
-                       /*
-                        *      The module failed, or said the request is
-                        *      invalid, therefore we stop here.
-                        */
-                       case RLM_MODULE_FAIL:
-                       case RLM_MODULE_INVALID:
-                       case RLM_MODULE_NOTFOUND:
-                       case RLM_MODULE_REJECT:
-                       case RLM_MODULE_USERLOCK:
-                       default:
-                               return result;
+               /*
+                *      The module has a number of OK return codes.
+                */
+               case RLM_MODULE_NOOP:
+               case RLM_MODULE_OK:
+               case RLM_MODULE_UPDATED:
+                       break;
+               /*
+                *      The module handled the request, stop here.
+                */
+               case RLM_MODULE_HANDLED:
+                       return result;
+               /*
+                *      The module failed, or said the request is
+                *      invalid, therefore we stop here.
+                */
+               case RLM_MODULE_FAIL:
+               case RLM_MODULE_INVALID:
+               case RLM_MODULE_NOTFOUND:
+               case RLM_MODULE_REJECT:
+               case RLM_MODULE_USERLOCK:
+               default:
+                       return result;
                }
 
                /*
@@ -92,30 +92,30 @@ int rad_accounting(REQUEST *request)
                }
                result = process_accounting(acct_type, request);
                switch (result) {
-                       /*
-                        *      In case the accounting module returns FAIL,
-                        *      it's still useful to send the data to the
-                        *      proxy.
-                        */
-                       case RLM_MODULE_FAIL:
-                       case RLM_MODULE_NOOP:
-                       case RLM_MODULE_OK:
-                       case RLM_MODULE_UPDATED:
-                               break;
-                       /*
-                        *      The module handled the request, don't reply.
-                        */
-                       case RLM_MODULE_HANDLED:
-                               return result;
-                       /*
-                        *      Neither proxy, nor reply to invalid requests.
-                        */
-                       case RLM_MODULE_INVALID:
-                       case RLM_MODULE_NOTFOUND:
-                       case RLM_MODULE_REJECT:
-                       case RLM_MODULE_USERLOCK:
-                       default:
-                               return result;
+               /*
+                *      In case the accounting module returns FAIL,
+                *      it's still useful to send the data to the
+                *      proxy.
+                */
+               case RLM_MODULE_FAIL:
+               case RLM_MODULE_NOOP:
+               case RLM_MODULE_OK:
+               case RLM_MODULE_UPDATED:
+                       break;
+               /*
+                *      The module handled the request, don't reply.
+                */
+               case RLM_MODULE_HANDLED:
+                       return result;
+               /*
+                *      Neither proxy, nor reply to invalid requests.
+                */
+               case RLM_MODULE_INVALID:
+               case RLM_MODULE_NOTFOUND:
+               case RLM_MODULE_REJECT:
+               case RLM_MODULE_USERLOCK:
+               default:
+                       return result;
                }
 
                /*
@@ -153,26 +153,26 @@ int rad_accounting(REQUEST *request)
         *      Accounting-Response.
         */
        switch (result) {
-               /*
-                *      Send back an ACK to the NAS.
-                */
-               case RLM_MODULE_OK:
-               case RLM_MODULE_UPDATED:
-                       request->reply->code = PW_CODE_ACCOUNTING_RESPONSE;
-                       break;
+       /*
+        *      Send back an ACK to the NAS.
+        */
+       case RLM_MODULE_OK:
+       case RLM_MODULE_UPDATED:
+               request->reply->code = PW_CODE_ACCOUNTING_RESPONSE;
+               break;
 
-               /*
-                *      Failed to log or to proxy the accounting data,
-                *      therefore don't reply to the NAS.
-                */
-               case RLM_MODULE_FAIL:
-               case RLM_MODULE_INVALID:
-               case RLM_MODULE_NOOP:
-               case RLM_MODULE_NOTFOUND:
-               case RLM_MODULE_REJECT:
-               case RLM_MODULE_USERLOCK:
-               default:
-                       break;
+       /*
+        *      Failed to log or to proxy the accounting data,
+        *      therefore don't reply to the NAS.
+        */
+       case RLM_MODULE_FAIL:
+       case RLM_MODULE_INVALID:
+       case RLM_MODULE_NOOP:
+       case RLM_MODULE_NOTFOUND:
+       case RLM_MODULE_REJECT:
+       case RLM_MODULE_USERLOCK:
+       default:
+               break;
        }
        return result;
 }
index e07d54b..47c608a 100644 (file)
@@ -253,28 +253,30 @@ static int CC_HINT(nonnull) rad_check_password(REQUEST *request)
         */
        result = process_authenticate(auth_type, request);
        switch (result) {
-               /*
-                *      An authentication module FAIL
-                *      return code, or any return code that
-                *      is not expected from authentication,
-                *      is the same as an explicit REJECT!
-                */
-               case RLM_MODULE_FAIL:
-               case RLM_MODULE_INVALID:
-               case RLM_MODULE_NOOP:
-               case RLM_MODULE_NOTFOUND:
-               case RLM_MODULE_REJECT:
-               case RLM_MODULE_UPDATED:
-               case RLM_MODULE_USERLOCK:
-               default:
-                       result = -1;
-                       break;
-               case RLM_MODULE_OK:
-                       result = 0;
-                       break;
-               case RLM_MODULE_HANDLED:
-                       result = 1;
-                       break;
+       /*
+        *      An authentication module FAIL
+        *      return code, or any return code that
+        *      is not expected from authentication,
+        *      is the same as an explicit REJECT!
+        */
+       case RLM_MODULE_FAIL:
+       case RLM_MODULE_INVALID:
+       case RLM_MODULE_NOOP:
+       case RLM_MODULE_NOTFOUND:
+       case RLM_MODULE_REJECT:
+       case RLM_MODULE_UPDATED:
+       case RLM_MODULE_USERLOCK:
+       default:
+               result = -1;
+               break;
+
+       case RLM_MODULE_OK:
+               result = 0;
+               break;
+
+       case RLM_MODULE_HANDLED:
+               result = 1;
+               break;
        }
 
        return result;
@@ -302,32 +304,32 @@ int rad_postauth(REQUEST *request)
        }
        result = process_post_auth(postauth_type, request);
        switch (result) {
-               /*
-                *      The module failed, or said to reject the user: Do so.
-                */
-               case RLM_MODULE_FAIL:
-               case RLM_MODULE_INVALID:
-               case RLM_MODULE_REJECT:
-               case RLM_MODULE_USERLOCK:
-               default:
-                       request->reply->code = PW_CODE_ACCESS_REJECT;
-                       result = RLM_MODULE_REJECT;
-                       break;
-               /*
-                *      The module handled the request, cancel the reply.
-                */
-               case RLM_MODULE_HANDLED:
-                       /* FIXME */
-                       break;
-               /*
-                *      The module had a number of OK return codes.
-                */
-               case RLM_MODULE_NOOP:
-               case RLM_MODULE_NOTFOUND:
-               case RLM_MODULE_OK:
-               case RLM_MODULE_UPDATED:
-                       result = RLM_MODULE_OK;
-                       break;
+       /*
+        *      The module failed, or said to reject the user: Do so.
+        */
+       case RLM_MODULE_FAIL:
+       case RLM_MODULE_INVALID:
+       case RLM_MODULE_REJECT:
+       case RLM_MODULE_USERLOCK:
+       default:
+               request->reply->code = PW_CODE_ACCESS_REJECT;
+               result = RLM_MODULE_REJECT;
+               break;
+       /*
+        *      The module handled the request, cancel the reply.
+        */
+       case RLM_MODULE_HANDLED:
+               /* FIXME */
+               break;
+       /*
+        *      The module had a number of OK return codes.
+        */
+       case RLM_MODULE_NOOP:
+       case RLM_MODULE_NOTFOUND:
+       case RLM_MODULE_OK:
+       case RLM_MODULE_UPDATED:
+               result = RLM_MODULE_OK;
+               break;
        }
        return result;
 }
@@ -418,29 +420,29 @@ int rad_authenticate(REQUEST *request)
         */
 autz_redo:
        result = process_authorize(autz_type, request);
-       switch (result) {
-               case RLM_MODULE_NOOP:
-               case RLM_MODULE_NOTFOUND:
-               case RLM_MODULE_OK:
-               case RLM_MODULE_UPDATED:
-                       break;
-               case RLM_MODULE_HANDLED:
-                       return result;
-               case RLM_MODULE_FAIL:
-               case RLM_MODULE_INVALID:
-               case RLM_MODULE_REJECT:
-               case RLM_MODULE_USERLOCK:
-               default:
-                       if ((module_msg = pairfind(request->packet->vps, PW_MODULE_FAILURE_MESSAGE, 0, TAG_ANY)) != NULL) {
-                               char msg[MAX_STRING_LEN + 16];
-                               snprintf(msg, sizeof(msg), "Invalid user (%s)",
-                                        module_msg->vp_strvalue);
-                               rad_authlog(msg,request,0);
-                       } else {
-                               rad_authlog("Invalid user", request, 0);
-                       }
-                       request->reply->code = PW_CODE_ACCESS_REJECT;
-                       return result;
+switch (result) {
+       case RLM_MODULE_NOOP:
+       case RLM_MODULE_NOTFOUND:
+       case RLM_MODULE_OK:
+       case RLM_MODULE_UPDATED:
+               break;
+       case RLM_MODULE_HANDLED:
+               return result;
+       case RLM_MODULE_FAIL:
+       case RLM_MODULE_INVALID:
+       case RLM_MODULE_REJECT:
+       case RLM_MODULE_USERLOCK:
+       default:
+               if ((module_msg = pairfind(request->packet->vps, PW_MODULE_FAILURE_MESSAGE, 0, TAG_ANY)) != NULL) {
+                       char msg[MAX_STRING_LEN + 16];
+                       snprintf(msg, sizeof(msg), "Invalid user (%s)",
+                                module_msg->vp_strvalue);
+                       rad_authlog(msg,request,0);
+               } else {
+                       rad_authlog("Invalid user", request, 0);
+               }
+               request->reply->code = PW_CODE_ACCESS_REJECT;
+               return result;
        }
        if (!autz_retry) {
                tmp = pairfind(request->config_items, PW_AUTZ_TYPE, 0, TAG_ANY);
index 1310e04..5c45e9d 100644 (file)
@@ -161,23 +161,24 @@ static rs_stats_tmpl_t *rs_stats_collectd_init(TALLOC_CTX *ctx, rs_t *conf,
 
                tmpl->value_tmpl[i] = values[i];
                switch (tmpl->value_tmpl[i].type) {
-                       case LCC_TYPE_COUNTER:
-                               tmpl->value_tmpl[i].dst = &value->values[i].counter;
-                               break;
-
-                       case LCC_TYPE_GAUGE:
-                               tmpl->value_tmpl[i].dst = &value->values[i].gauge;
-                               break;
-
-                       case LCC_TYPE_DERIVE:
-                               tmpl->value_tmpl[i].dst = &value->values[i].derive;
-                               break;
-
-                       case LCC_TYPE_ABSOLUTE:
-                               tmpl->value_tmpl[i].dst = &value->values[i].absolute;
-                               break;
-                       default:
-                               assert(0);
+               case LCC_TYPE_COUNTER:
+                       tmpl->value_tmpl[i].dst = &value->values[i].counter;
+                       break;
+
+               case LCC_TYPE_GAUGE:
+                       tmpl->value_tmpl[i].dst = &value->values[i].gauge;
+                       break;
+
+               case LCC_TYPE_DERIVE:
+                       tmpl->value_tmpl[i].dst = &value->values[i].derive;
+                       break;
+
+               case LCC_TYPE_ABSOLUTE:
+                       tmpl->value_tmpl[i].dst = &value->values[i].absolute;
+                       break;
+
+               default:
+                       assert(0);
                }
                value->values_types[i] = tmpl->value_tmpl[i].type;
        }
index 06c1295..c761811 100644 (file)
@@ -363,159 +363,159 @@ static RADIUS_PACKET *detail_poll(rad_listen_t *listener)
        listen_detail_t *data = listener->data;
 
        switch (data->state) {
-               case STATE_UNOPENED:
-       open_file:
-                       rad_assert(data->work_fd < 0);
+       case STATE_UNOPENED:
+open_file:
+               rad_assert(data->work_fd < 0);
 
-                       if (!detail_open(listener)) return NULL;
+               if (!detail_open(listener)) return NULL;
 
-                       rad_assert(data->state == STATE_UNLOCKED);
-                       rad_assert(data->work_fd >= 0);
+               rad_assert(data->state == STATE_UNLOCKED);
+               rad_assert(data->work_fd >= 0);
 
-                       /* FALL-THROUGH */
+               /* FALL-THROUGH */
 
+               /*
+                *      Try to lock fd.  If we can't, return.
+                *      If we can, continue.  This means that
+                *      the server doesn't block while waiting
+                *      for the lock to open...
+                */
+       case STATE_UNLOCKED:
+               /*
+                *      Note that we do NOT block waiting for
+                *      the lock.  We've re-named the file
+                *      above, so we've already guaranteed
+                *      that any *new* detail writer will not
+                *      be opening this file.  The only
+                *      purpose of the lock is to catch a race
+                *      condition where the execution
+                *      "ping-pongs" between radiusd &
+                *      radrelay.
+                */
+               if (rad_lockfd_nonblock(data->work_fd, 0) < 0) {
                        /*
-                        *      Try to lock fd.  If we can't, return.
-                        *      If we can, continue.  This means that
-                        *      the server doesn't block while waiting
-                        *      for the lock to open...
-                        */
-               case STATE_UNLOCKED:
-                       /*
-                        *      Note that we do NOT block waiting for
-                        *      the lock.  We've re-named the file
-                        *      above, so we've already guaranteed
-                        *      that any *new* detail writer will not
-                        *      be opening this file.  The only
-                        *      purpose of the lock is to catch a race
-                        *      condition where the execution
-                        *      "ping-pongs" between radiusd &
-                        *      radrelay.
+                        *      Close the FD.  The main loop
+                        *      will wake up in a second and
+                        *      try again.
                         */
-                       if (rad_lockfd_nonblock(data->work_fd, 0) < 0) {
-                               /*
-                                *      Close the FD.  The main loop
-                                *      will wake up in a second and
-                                *      try again.
-                                */
-                               close(data->work_fd);
-                               data->work_fd = -1;
-                               data->state = STATE_UNOPENED;
-                               return NULL;
-                       }
+                       close(data->work_fd);
+                       data->work_fd = -1;
+                       data->state = STATE_UNOPENED;
+                       return NULL;
+               }
 
-                       data->fp = fdopen(data->work_fd, "r");
-                       if (!data->fp) {
-                               ERROR("FATAL: Failed to re-open detail file %s: %s",
-                                      data->filename, fr_syserror(errno));
-                               fr_exit(1);
-                       }
+               data->fp = fdopen(data->work_fd, "r");
+               if (!data->fp) {
+                       ERROR("FATAL: Failed to re-open detail file %s: %s",
+                              data->filename, fr_syserror(errno));
+                       fr_exit(1);
+               }
 
-                       /*
-                        *      Look for the header
-                        */
-                       data->state = STATE_HEADER;
-                       data->delay_time = USEC;
-                       data->vps = NULL;
-
-                       /* FALL-THROUGH */
-
-               case STATE_HEADER:
-               do_header:
-                       data->tries = 0;
-                       if (!data->fp) {
-                               data->state = STATE_UNOPENED;
-                               goto open_file;
-                       }
+               /*
+                *      Look for the header
+                */
+               data->state = STATE_HEADER;
+               data->delay_time = USEC;
+               data->vps = NULL;
 
-                       {
-                               struct stat buf;
+               /* FALL-THROUGH */
 
-                               if (fstat(data->work_fd, &buf) < 0) {
-                                       ERROR("Failed to stat "
-                                              "detail file %s: %s",
-                                               data->filename,
-                                               fr_syserror(errno));
+       case STATE_HEADER:
+       do_header:
+               data->tries = 0;
+               if (!data->fp) {
+                       data->state = STATE_UNOPENED;
+                       goto open_file;
+               }
 
-                                       goto cleanup;
-                               }
-                               if (((off_t) ftell(data->fp)) == buf.st_size) {
-                                       goto cleanup;
-                               }
-                       }
+               {
+                       struct stat buf;
 
-                       /*
-                        *      End of file.  Delete it, and re-set
-                        *      everything.
-                        */
-                       if (feof(data->fp)) {
-                       cleanup:
-                               DEBUG("Detail - unlinking %s",
-                                     data->filename_work);
-                               unlink(data->filename_work);
-                               if (data->fp) fclose(data->fp);
-                               data->fp = NULL;
-                               data->work_fd = -1;
-                               data->state = STATE_UNOPENED;
-                               rad_assert(data->vps == NULL);
-
-                               if (data->one_shot) {
-                                       INFO("Finished reading \"one shot\" detail file - Exiting");
-                                       radius_signal_self(RADIUS_SIGNAL_SELF_EXIT);
-                               }
+                       if (fstat(data->work_fd, &buf) < 0) {
+                               ERROR("Failed to stat "
+                                      "detail file %s: %s",
+                                       data->filename,
+                                       fr_syserror(errno));
 
-                               return NULL;
+                               goto cleanup;
+                       }
+                       if (((off_t) ftell(data->fp)) == buf.st_size) {
+                               goto cleanup;
                        }
+               }
 
-                       /*
-                        *      Else go read something.
-                        */
-                       break;
+               /*
+                *      End of file.  Delete it, and re-set
+                *      everything.
+                */
+               if (feof(data->fp)) {
+               cleanup:
+                       DEBUG("Detail - unlinking %s",
+                             data->filename_work);
+                       unlink(data->filename_work);
+                       if (data->fp) fclose(data->fp);
+                       data->fp = NULL;
+                       data->work_fd = -1;
+                       data->state = STATE_UNOPENED;
+                       rad_assert(data->vps == NULL);
+
+                       if (data->one_shot) {
+                               INFO("Finished reading \"one shot\" detail file - Exiting");
+                               radius_signal_self(RADIUS_SIGNAL_SELF_EXIT);
+                       }
 
-                       /*
-                        *      Read more value-pair's, unless we're
-                        *      at EOF.  In that case, queue whatever
-                        *      we have.
-                        */
-               case STATE_READING:
-                       if (data->fp && !feof(data->fp)) break;
-                       data->state = STATE_QUEUED;
+                       return NULL;
+               }
 
-                       /* FALL-THROUGH */
+               /*
+                *      Else go read something.
+                */
+               break;
 
-               case STATE_QUEUED:
-                       goto alloc_packet;
+               /*
+                *      Read more value-pair's, unless we're
+                *      at EOF.  In that case, queue whatever
+                *      we have.
+                */
+       case STATE_READING:
+               if (data->fp && !feof(data->fp)) break;
+               data->state = STATE_QUEUED;
 
-                       /*
-                        *      Periodically check what's going on.
-                        *      If the request is taking too long,
-                        *      retry it.
-                        */
-               case STATE_RUNNING:
-                       if (time(NULL) < (data->running + (int)data->retry_interval)) {
-                               return NULL;
-                       }
+               /* FALL-THROUGH */
 
-                       DEBUG("No response to detail request.  Retrying");
-                       /* FALL-THROUGH */
+       case STATE_QUEUED:
+               goto alloc_packet;
 
-                       /*
-                        *      If there's no reply, keep
-                        *      retransmitting the current packet
-                        *      forever.
-                        */
-               case STATE_NO_REPLY:
-                       data->state = STATE_QUEUED;
-                       goto alloc_packet;
+               /*
+                *      Periodically check what's going on.
+                *      If the request is taking too long,
+                *      retry it.
+                */
+       case STATE_RUNNING:
+               if (time(NULL) < (data->running + (int)data->retry_interval)) {
+                       return NULL;
+               }
 
-                       /*
-                        *      We have a reply.  Clean up the old
-                        *      request, and go read another one.
-                        */
-               case STATE_REPLIED:
-                       pairfree(&data->vps);
-                       data->state = STATE_HEADER;
-                       goto do_header;
+               DEBUG("No response to detail request.  Retrying");
+               /* FALL-THROUGH */
+
+               /*
+                *      If there's no reply, keep
+                *      retransmitting the current packet
+                *      forever.
+                */
+       case STATE_NO_REPLY:
+               data->state = STATE_QUEUED;
+               goto alloc_packet;
+
+               /*
+                *      We have a reply.  Clean up the old
+                *      request, and go read another one.
+                */
+       case STATE_REPLIED:
+               pairfree(&data->vps);
+               data->state = STATE_HEADER;
+               goto do_header;
        }
 
        fr_cursor_init(&cursor, &data->vps);
index bcecfd9..ede857f 100644 (file)
@@ -406,7 +406,6 @@ static int do_cast_copy(VALUE_PAIR *dst, VALUE_PAIR const *src)
                        dst->vp_integer = ntohll(*(uint64_t const *) src->vp_octets);
                        break;
 
-
                case PW_TYPE_INTEGER:
                case PW_TYPE_DATE:
                case PW_TYPE_SIGNED:
index be09cc2..7a593e1 100644 (file)
@@ -174,17 +174,17 @@ lt_dlhandle lt_dlopenext(char const *name)
         *      Because dlopen produces really shitty and inaccurate error messages
         */
        if (access(name, R_OK) < 0) switch (errno) {
-               case EACCES:
-                       WARN("Library file found, but we don't have permission to read it");
-                       break;
+       case EACCES:
+               WARN("Library file found, but we don't have permission to read it");
+               break;
 
-               case ENOENT:
-                       DEBUG4("Library file not found");
-                       break;
+       case ENOENT:
+               DEBUG4("Library file not found");
+               break;
 
-               default:
-                       DEBUG4("Issue accessing library file: %s", fr_syserror(errno));
-                       break;
+       default:
+               DEBUG4("Issue accessing library file: %s", fr_syserror(errno));
+               break;
        }
 
        DEBUG4("Falling back to linker search path(s)");
index 6bc75e7..b0f692a 100644 (file)
@@ -441,17 +441,19 @@ int main(int argc, char **argv)
                        printf("NAS-Port = %u\n", rt.nas_port);
 
                        switch (rt.proto) {
-                               case 'S':
-                                       printf("Service-Type = Framed-User\n");
-                                       printf("Framed-Protocol = SLIP\n");
-                                       break;
-                               case 'P':
-                                       printf("Service-Type = Framed-User\n");
-                                       printf("Framed-Protocol = PPP\n");
-                                       break;
-                               default:
-                                       printf("Service-type = Login-User\n");
-                                       break;
+                       case 'S':
+                               printf("Service-Type = Framed-User\n");
+                               printf("Framed-Protocol = SLIP\n");
+                               break;
+
+                       case 'P':
+                               printf("Service-Type = Framed-User\n");
+                               printf("Framed-Protocol = PPP\n");
+                               break;
+
+                       default:
+                               printf("Service-type = Login-User\n");
+                               break;
                        }
                        if (rt.framed_address != INADDR_NONE) {
                                printf("Framed-IP-Address = %s\n",
index b37d0ea..e8c7254 100644 (file)
@@ -2116,10 +2116,12 @@ home_server_t *home_server_ldb(char const *realmname,
                        hash = fr_hash(&request->packet->src_ipaddr.ipaddr.ip4addr,
                                         sizeof(request->packet->src_ipaddr.ipaddr.ip4addr));
                        break;
+
                case AF_INET6:
                        hash = fr_hash(&request->packet->src_ipaddr.ipaddr.ip6addr,
                                         sizeof(request->packet->src_ipaddr.ipaddr.ip6addr));
                        break;
+
                default:
                        hash = 0;
                        break;
@@ -2133,10 +2135,12 @@ home_server_t *home_server_ldb(char const *realmname,
                        hash = fr_hash(&request->packet->src_ipaddr.ipaddr.ip4addr,
                                         sizeof(request->packet->src_ipaddr.ipaddr.ip4addr));
                        break;
+
                case AF_INET6:
                        hash = fr_hash(&request->packet->src_ipaddr.ipaddr.ip6addr,
                                         sizeof(request->packet->src_ipaddr.ipaddr.ip6addr));
                        break;
+
                default:
                        hash = 0;
                        break;
index ddb85fa..af59612 100644 (file)
@@ -152,159 +152,159 @@ static int CC_HINT(nonnull) eapsoh_mstlv(REQUEST *request, uint8_t const *p, uns
                data_len--;
 
                switch (c) {
-                       case 1:
-                               /* MS-Machine-Inventory-Packet
-                                * MS-SOH section 2.2.4.1
-                                */
-                               if (data_len < 18) {
-                                       RDEBUG("insufficient data for MS-Machine-Inventory-Packet");
-                                       return 0;
-                               }
-                               data_len -= 18;
+               case 1:
+                       /* MS-Machine-Inventory-Packet
+                        * MS-SOH section 2.2.4.1
+                        */
+                       if (data_len < 18) {
+                               RDEBUG("insufficient data for MS-Machine-Inventory-Packet");
+                               return 0;
+                       }
+                       data_len -= 18;
 
-                               vp = pairmake_packet("SoH-MS-Machine-OS-vendor", "Microsoft", T_OP_EQ);
-                               if (!vp) return 0;
+                       vp = pairmake_packet("SoH-MS-Machine-OS-vendor", "Microsoft", T_OP_EQ);
+                       if (!vp) return 0;
 
-                               vp = pairmake_packet("SoH-MS-Machine-OS-version", NULL, T_OP_EQ);
-                               if (!vp) return 0;
+                       vp = pairmake_packet("SoH-MS-Machine-OS-version", NULL, T_OP_EQ);
+                       if (!vp) return 0;
 
-                               vp->vp_integer = soh_pull_be_32(p); p+=4;
+                       vp->vp_integer = soh_pull_be_32(p); p+=4;
 
-                               vp = pairmake_packet("SoH-MS-Machine-OS-release", NULL, T_OP_EQ);
-                               if (!vp) return 0;
+                       vp = pairmake_packet("SoH-MS-Machine-OS-release", NULL, T_OP_EQ);
+                       if (!vp) return 0;
 
-                               vp->vp_integer = soh_pull_be_32(p); p+=4;
+                       vp->vp_integer = soh_pull_be_32(p); p+=4;
 
-                               vp = pairmake_packet("SoH-MS-Machine-OS-build", NULL, T_OP_EQ);
-                               if (!vp) return 0;
+                       vp = pairmake_packet("SoH-MS-Machine-OS-build", NULL, T_OP_EQ);
+                       if (!vp) return 0;
 
-                               vp->vp_integer = soh_pull_be_32(p); p+=4;
+                       vp->vp_integer = soh_pull_be_32(p); p+=4;
 
-                               vp = pairmake_packet("SoH-MS-Machine-SP-version", NULL, T_OP_EQ);
-                               if (!vp) return 0;
+                       vp = pairmake_packet("SoH-MS-Machine-SP-version", NULL, T_OP_EQ);
+                       if (!vp) return 0;
 
-                               vp->vp_integer = soh_pull_be_16(p); p+=2;
+                       vp->vp_integer = soh_pull_be_16(p); p+=2;
 
-                               vp = pairmake_packet("SoH-MS-Machine-SP-release", NULL, T_OP_EQ);
-                               if (!vp) return 0;
+                       vp = pairmake_packet("SoH-MS-Machine-SP-release", NULL, T_OP_EQ);
+                       if (!vp) return 0;
 
-                               vp->vp_integer = soh_pull_be_16(p); p+=2;
+                       vp->vp_integer = soh_pull_be_16(p); p+=2;
 
-                               vp = pairmake_packet("SoH-MS-Machine-Processor", NULL, T_OP_EQ);
-                               if (!vp) return 0;
+                       vp = pairmake_packet("SoH-MS-Machine-Processor", NULL, T_OP_EQ);
+                       if (!vp) return 0;
 
-                               vp->vp_integer = soh_pull_be_16(p); p+=2;
-                               break;
-
-                       case 2:
-                               /* MS-Quarantine-State - FIXME: currently unhandled
-                                * MS-SOH 2.2.4.1
-                                *
-                                * 1 byte reserved
-                                * 1 byte flags
-                                * 8 bytes NT Time field (100-nanosec since 1 Jan 1601)
-                                * 2 byte urilen
-                                * N bytes uri
-                                */
-                               p += 10;
-                               t = soh_pull_be_16(p);  /* t == uri len */
-                               p += 2;
-                               p += t;
-                               data_len -= 12 + t;
-                               break;
-
-                       case 3:
-                               /* MS-Packet-Info
-                                * MS-SOH 2.2.4.3
-                                */
-                               RDEBUG3("SoH MS-Packet-Info %s vers=%i", *p & 0x10 ? "request" : "response", *p & 0xf);
-                               p++;
-                               data_len--;
-                               break;
-
-                       case 4:
-                               /* MS-SystemGenerated-Ids - FIXME: currently unhandled
-                                * MS-SOH 2.2.4.4
-                                *
-                                * 2 byte length
-                                * N bytes (3 bytes IANA enterprise# + 1 byte component id#)
-                                */
-                               t = soh_pull_be_16(p);
-                               p += 2;
-                               p += t;
-                               data_len -= 2 + t;
-                               break;
-
-                       case 5:
-                               /* MS-MachineName
-                                * MS-SOH 2.2.4.5
-                                *
-                                * 1 byte namelen
-                                * N bytes name
-                                */
-                               t = soh_pull_be_16(p);
-                               p += 2;
-
-                               vp = pairmake_packet("SoH-MS-Machine-Name", NULL, T_OP_EQ);
-                               if (!vp) return 0;
+                       vp->vp_integer = soh_pull_be_16(p); p+=2;
+                       break;
 
-                               vp->vp_strvalue = q = talloc_array(vp, char, t);
-                               vp->type = VT_DATA;
+               case 2:
+                       /* MS-Quarantine-State - FIXME: currently unhandled
+                        * MS-SOH 2.2.4.1
+                        *
+                        * 1 byte reserved
+                        * 1 byte flags
+                        * 8 bytes NT Time field (100-nanosec since 1 Jan 1601)
+                        * 2 byte urilen
+                        * N bytes uri
+                        */
+                       p += 10;
+                       t = soh_pull_be_16(p);  /* t == uri len */
+                       p += 2;
+                       p += t;
+                       data_len -= 12 + t;
+                       break;
 
-                               memcpy(q, p, t);
-                               q[t] = 0;
+               case 3:
+                       /* MS-Packet-Info
+                        * MS-SOH 2.2.4.3
+                        */
+                       RDEBUG3("SoH MS-Packet-Info %s vers=%i", *p & 0x10 ? "request" : "response", *p & 0xf);
+                       p++;
+                       data_len--;
+                       break;
 
-                               p += t;
-                               data_len -= 2 + t;
-                               break;
+               case 4:
+                       /* MS-SystemGenerated-Ids - FIXME: currently unhandled
+                        * MS-SOH 2.2.4.4
+                        *
+                        * 2 byte length
+                        * N bytes (3 bytes IANA enterprise# + 1 byte component id#)
+                        */
+                       t = soh_pull_be_16(p);
+                       p += 2;
+                       p += t;
+                       data_len -= 2 + t;
+                       break;
 
-                       case 6:
-                               /* MS-CorrelationId
-                                * MS-SOH 2.2.4.6
-                                *
-                                * 24 bytes opaque binary which we might, in future, have
-                                * to echo back to the client in a final SoHR
-                                */
-                               vp = pairmake_packet("SoH-MS-Correlation-Id", NULL, T_OP_EQ);
-                               if (!vp) return 0;
+               case 5:
+                       /* MS-MachineName
+                        * MS-SOH 2.2.4.5
+                        *
+                        * 1 byte namelen
+                        * N bytes name
+                        */
+                       t = soh_pull_be_16(p);
+                       p += 2;
 
-                               pairmemcpy(vp, p, 24);
-                               p += 24;
-                               data_len -= 24;
-                               break;
-
-                       case 7:
-                               /* MS-Installed-Shvs - FIXME: currently unhandled
-                                * MS-SOH 2.2.4.7
-                                *
-                                * 2 bytes length
-                                * N bytes (3 bytes IANA enterprise# + 1 byte component id#)
-                                */
-                               t = soh_pull_be_16(p);
-                               p += 2;
-                               p += t;
-                               data_len -= 2 + t;
-                               break;
-
-                       case 8:
-                               /* MS-Machine-Inventory-Ex
-                                * MS-SOH 2.2.4.8
-                                *
-                                * 4 bytes reserved
-                                * 1 byte product type (client=1 domain_controller=2 server=3)
-                                */
-                               p += 4;
-                               vp = pairmake_packet("SoH-MS-Machine-Role", NULL, T_OP_EQ);
-                               if (!vp) return 0;
+                       vp = pairmake_packet("SoH-MS-Machine-Name", NULL, T_OP_EQ);
+                       if (!vp) return 0;
 
-                               vp->vp_integer = *p;
-                               p++;
-                               data_len -= 5;
-                               break;
+                       vp->vp_strvalue = q = talloc_array(vp, char, t);
+                       vp->type = VT_DATA;
 
-                       default:
-                               RDEBUG("SoH Unknown MS TV %i stopping", c);
-                               return 0;
+                       memcpy(q, p, t);
+                       q[t] = 0;
+
+                       p += t;
+                       data_len -= 2 + t;
+                       break;
+
+               case 6:
+                       /* MS-CorrelationId
+                        * MS-SOH 2.2.4.6
+                        *
+                        * 24 bytes opaque binary which we might, in future, have
+                        * to echo back to the client in a final SoHR
+                        */
+                       vp = pairmake_packet("SoH-MS-Correlation-Id", NULL, T_OP_EQ);
+                       if (!vp) return 0;
+
+                       pairmemcpy(vp, p, 24);
+                       p += 24;
+                       data_len -= 24;
+                       break;
+
+               case 7:
+                       /* MS-Installed-Shvs - FIXME: currently unhandled
+                        * MS-SOH 2.2.4.7
+                        *
+                        * 2 bytes length
+                        * N bytes (3 bytes IANA enterprise# + 1 byte component id#)
+                        */
+                       t = soh_pull_be_16(p);
+                       p += 2;
+                       p += t;
+                       data_len -= 2 + t;
+                       break;
+
+               case 8:
+                       /* MS-Machine-Inventory-Ex
+                        * MS-SOH 2.2.4.8
+                        *
+                        * 4 bytes reserved
+                        * 1 byte product type (client=1 domain_controller=2 server=3)
+                        */
+                       p += 4;
+                       vp = pairmake_packet("SoH-MS-Machine-Role", NULL, T_OP_EQ);
+                       if (!vp) return 0;
+
+                       vp->vp_integer = *p;
+                       p++;
+                       data_len -= 5;
+                       break;
+
+               default:
+                       RDEBUG("SoH Unknown MS TV %i stopping", c);
+                       return 0;
                }
        }
        return 1;
@@ -315,29 +315,37 @@ static int CC_HINT(nonnull) eapsoh_mstlv(REQUEST *request, uint8_t const *p, uns
  */
 static char const* clientstatus2str(uint32_t hcstatus) {
        switch (hcstatus) {
-               /* this lot should all just be for windows updates */
-               case 0xff0005:
-                       return "wua-ok";
-               case 0xff0006:
-                       return "wua-missing";
-               case 0xff0008:
-                       return "wua-not-started";
-               case 0xc0ff000c:
-                       return "wua-no-wsus-server";
-               case 0xc0ff000d:
-                       return "wua-no-wsus-clientid";
-               case 0xc0ff000e:
-                       return "wua-disabled";
-               case 0xc0ff000f:
-                       return "wua-comm-failure";
-
-               /* these next 3 are for all health-classes */
-               case 0xc0ff0002:
-                       return "not-installed";
-               case 0xc0ff0003:
-                       return "down";
-               case 0xc0ff0018:
-                       return "not-started";
+       /* this lot should all just be for windows updates */
+       case 0xff0005:
+               return "wua-ok";
+
+       case 0xff0006:
+               return "wua-missing";
+
+       case 0xff0008:
+               return "wua-not-started";
+
+       case 0xc0ff000c:
+               return "wua-no-wsus-server";
+
+       case 0xc0ff000d:
+               return "wua-no-wsus-clientid";
+
+       case 0xc0ff000e:
+               return "wua-disabled";
+
+       case 0xc0ff000f:
+               return "wua-comm-failure";
+
+       /* these next 3 are for all health-classes */
+       case 0xc0ff0002:
+               return "not-installed";
+
+       case 0xc0ff0003:
+               return "down";
+
+       case 0xc0ff0018:
+               return "not-started";
        }
        return NULL;
 }
@@ -347,16 +355,20 @@ static char const* clientstatus2str(uint32_t hcstatus) {
  */
 static char const* healthclass2str(uint8_t hc) {
        switch (hc) {
-               case 0:
-                       return "firewall";
-               case 1:
-                       return "antivirus";
-               case 2:
-                       return "antispyware";
-               case 3:
-                       return "updates";
-               case 4:
-                       return "security-updates";
+       case 0:
+               return "firewall";
+
+       case 1:
+               return "antivirus";
+
+       case 2:
+               return "antispyware";
+
+       case 3:
+               return "updates";
+
+       case 4:
+               return "security-updates";
        }
        return NULL;
 }
@@ -413,28 +425,30 @@ int soh_verify(REQUEST *request, uint8_t const *data, unsigned int data_len) {
                return -1;
        }
        switch (resp.inner_type) {
-               case 1:
-                       /* no mode sub-header */
-                       RDEBUG("SoH without mode subheader");
-                       break;
-               case 2:
-                       mode.outer_type = soh_pull_be_16(data); data += 2;
-                       mode.outer_len = soh_pull_be_16(data); data += 2;
-                       mode.vendor = soh_pull_be_32(data); data += 4;
-                       memcpy(mode.corrid, data, 24); data += 24;
-                       mode.intent = data[0];
-                       mode.content_type = data[1];
-                       data += 2;
-
-                       if (mode.outer_type != 7 || mode.vendor != 0x137 || mode.content_type != 0) {
-                               RDEBUG3("SoH mode subheader outer type %i/vendor %08x/content type %i invalid", mode.outer_type, mode.vendor, mode.content_type);
-                               return -1;
-                       }
-                       RDEBUG3("SoH with mode subheader");
-                       break;
-               default:
-                       RDEBUG("SoH invalid inner type %i", resp.inner_type);
+       case 1:
+               /* no mode sub-header */
+               RDEBUG("SoH without mode subheader");
+               break;
+
+       case 2:
+               mode.outer_type = soh_pull_be_16(data); data += 2;
+               mode.outer_len = soh_pull_be_16(data); data += 2;
+               mode.vendor = soh_pull_be_32(data); data += 4;
+               memcpy(mode.corrid, data, 24); data += 24;
+               mode.intent = data[0];
+               mode.content_type = data[1];
+               data += 2;
+
+               if (mode.outer_type != 7 || mode.vendor != 0x137 || mode.content_type != 0) {
+                       RDEBUG3("SoH mode subheader outer type %i/vendor %08x/content type %i invalid", mode.outer_type, mode.vendor, mode.content_type);
                        return -1;
+               }
+               RDEBUG3("SoH with mode subheader");
+               break;
+
+       default:
+               RDEBUG("SoH invalid inner type %i", resp.inner_type);
+               return -1;
        }
 
        /* subtract off the relevant amount of data */
@@ -462,186 +476,201 @@ int soh_verify(REQUEST *request, uint8_t const *data, unsigned int data_len) {
                data_len -= 4;
 
                switch (tlv.tlv_type) {
-                       case 2:
-                               /* System-Health-Id TLV
-                                * MS-SOH 2.2.3.1
-                                *
-                                * 3 bytes IANA/SMI vendor code
-                                * 1 byte component (i.e. within vendor, which SoH component
-                                */
-                               curr_shid = soh_pull_be_24(data);
-                               curr_shid_c = data[3];
-                               RDEBUG2("SoH System-Health-ID vendor %08x component=%i", curr_shid, curr_shid_c);
-                               break;
-
-                       case 7:
-                               /* Vendor-Specific packet
-                                * MS-SOH 2.2.3.3
-                                *
-                                * 4 bytes vendor, supposedly ignored by NAP
-                                * N bytes payload; for Microsoft component#0 this is the MS TV stuff
-                                */
-                               if (curr_shid==0x137 && curr_shid_c==0) {
-                                       RDEBUG2("SoH MS type-value payload");
-                                       eapsoh_mstlv(request, data + 4, tlv.tlv_len - 4);
-                               } else {
-                                       RDEBUG2("SoH unhandled vendor-specific TLV %08x/component=%i %i bytes payload", curr_shid, curr_shid_c, tlv.tlv_len);
-                               }
-                               break;
-
-                       case 8:
-                               /* Health-Class
-                                * MS-SOH 2.2.3.5.6
-                                *
-                                * 1 byte integer
-                                */
-                               RDEBUG2("SoH Health-Class %i", data[0]);
-                               curr_hc = data[0];
-                               break;
-
-                       case 9:
-                               /* Software-Version
-                                * MS-SOH 2.2.3.5.7
-                                *
-                                * 1 byte integer
-                                */
-                               RDEBUG2("SoH Software-Version %i", data[0]);
-                               break;
-
-                       case 11:
-                               /* Health-Class status
-                                * MS-SOH 2.2.3.5.9
-                                *
-                                * variable data; for the MS System Health vendor, these are 4-byte
-                                * integers which are a really, really dumb format:
-                                *
-                                *  28 bits ignore
-                                *  1 bit - 1==product snoozed
-                                *  1 bit - 1==microsoft product
-                                *  1 bit - 1==product up-to-date
-                                *  1 bit - 1==product enabled
-                                */
-                               RDEBUG2("SoH Health-Class-Status - current shid=%08x component=%i", curr_shid, curr_shid_c);
-
-                               if (curr_shid==0x137 && curr_shid_c==128) {
-
-                                       char const *s, *t;
-                                       uint32_t hcstatus = soh_pull_be_32(data);
-
-                                       RDEBUG2("SoH Health-Class-Status microsoft DWORD=%08x", hcstatus);
-
-                                       vp = pairmake_packet("SoH-MS-Windows-Health-Status", NULL, T_OP_EQ);
-                                       if (!vp) return 0;
-
-                                       switch (curr_hc) {
-                                               case 4:
-                                                       /* security updates */
-                                                       s = "security-updates";
-                                                       switch (hcstatus) {
-                                                               case 0xff0005:
-                                                                       pairsprintf(vp, "%s ok all-installed", s);
-                                                                       break;
-                                                               case 0xff0006:
-                                                                       pairsprintf(vp, "%s warn some-missing", s);
-                                                                       break;
-                                                               case 0xff0008:
-                                                                       pairsprintf(vp, "%s warn never-started", s);
-                                                                       break;
-                                                               case 0xc0ff000c:
-                                                                       pairsprintf(vp, "%s error no-wsus-srv", s);
-                                                                       break;
-                                                               case 0xc0ff000d:
-                                                                       pairsprintf(vp, "%s error no-wsus-clid", s);
-                                                                       break;
-                                                               case 0xc0ff000e:
-                                                                       pairsprintf(vp, "%s warn wsus-disabled", s);
-                                                                       break;
-                                                               case 0xc0ff000f:
-                                                                       pairsprintf(vp, "%s error comm-failure", s);
-                                                                       break;
-                                                               case 0xc0ff0010:
-                                                                       pairsprintf(vp, "%s warn needs-reboot", s);
-                                                                       break;
-                                                               default:
-                                                                       pairsprintf(vp, "%s error %08x", s, hcstatus);
-                                                                       break;
-                                                       }
-                                                       break;
-
-                                               case 3:
-                                                       /* auto updates */
-                                                       s = "auto-updates";
-                                                       switch (hcstatus) {
-                                                               case 1:
-                                                                       pairsprintf(vp, "%s warn disabled", s);
-                                                                       break;
-                                                               case 2:
-                                                                       pairsprintf(vp, "%s ok action=check-only", s);
-                                                                       break;
-                                                               case 3:
-                                                                       pairsprintf(vp, "%s ok action=download", s);
-                                                                       break;
-                                                               case 4:
-                                                                       pairsprintf(vp, "%s ok action=install", s);
-                                                                       break;
-                                                               case 5:
-                                                                       pairsprintf(vp, "%s warn unconfigured", s);
-                                                                       break;
-                                                               case 0xc0ff0003:
-                                                                       pairsprintf(vp, "%s warn service-down", s);
-                                                                       break;
-                                                               case 0xc0ff0018:
-                                                                       pairsprintf(vp, "%s warn never-started", s);
-                                                                       break;
-                                                               default:
-                                                                       pairsprintf(vp, "%s error %08x", s, hcstatus);
-                                                                       break;
-                                                       }
-                                                       break;
-
-                                               default:
-                                                       /* other - firewall, antivirus, antispyware */
-                                                       s = healthclass2str(curr_hc);
-                                                       if (s) {
-                                                               /* bah. this is vile. stupid microsoft
-                                                                */
-                                                               if (hcstatus & 0xff000000) {
-                                                                       /* top octet non-zero means an error
-                                                                        * FIXME: is this always correct? MS-WSH 2.2.8 is unclear
-                                                                        */
-                                                                       t = clientstatus2str(hcstatus);
-                                                                       if (t) {
-                                                                               pairsprintf(vp, "%s error %s", s, t);
-                                                                       } else {
-                                                                               pairsprintf(vp, "%s error %08x", s, hcstatus);
-                                                                       }
-                                                               } else {
-                                                                       pairsprintf(vp,
-                                                                                       "%s ok snoozed=%i microsoft=%i up2date=%i enabled=%i",
-                                                                                       s,
-                                                                                       hcstatus & 0x8 ? 1 : 0,
-                                                                                       hcstatus & 0x4 ? 1 : 0,
-                                                                                       hcstatus & 0x2 ? 1 : 0,
-                                                                                       hcstatus & 0x1 ? 1 : 0
-                                                                                       );
-                                                               }
+               case 2:
+                       /* System-Health-Id TLV
+                        * MS-SOH 2.2.3.1
+                        *
+                        * 3 bytes IANA/SMI vendor code
+                        * 1 byte component (i.e. within vendor, which SoH component
+                        */
+                       curr_shid = soh_pull_be_24(data);
+                       curr_shid_c = data[3];
+                       RDEBUG2("SoH System-Health-ID vendor %08x component=%i", curr_shid, curr_shid_c);
+                       break;
+
+               case 7:
+                       /* Vendor-Specific packet
+                        * MS-SOH 2.2.3.3
+                        *
+                        * 4 bytes vendor, supposedly ignored by NAP
+                        * N bytes payload; for Microsoft component#0 this is the MS TV stuff
+                        */
+                       if (curr_shid==0x137 && curr_shid_c==0) {
+                               RDEBUG2("SoH MS type-value payload");
+                               eapsoh_mstlv(request, data + 4, tlv.tlv_len - 4);
+                       } else {
+                               RDEBUG2("SoH unhandled vendor-specific TLV %08x/component=%i %i bytes payload",
+                                       curr_shid, curr_shid_c, tlv.tlv_len);
+                       }
+                       break;
+
+               case 8:
+                       /* Health-Class
+                        * MS-SOH 2.2.3.5.6
+                        *
+                        * 1 byte integer
+                        */
+                       RDEBUG2("SoH Health-Class %i", data[0]);
+                       curr_hc = data[0];
+                       break;
+
+               case 9:
+                       /* Software-Version
+                        * MS-SOH 2.2.3.5.7
+                        *
+                        * 1 byte integer
+                        */
+                       RDEBUG2("SoH Software-Version %i", data[0]);
+                       break;
+
+               case 11:
+                       /* Health-Class status
+                        * MS-SOH 2.2.3.5.9
+                        *
+                        * variable data; for the MS System Health vendor, these are 4-byte
+                        * integers which are a really, really dumb format:
+                        *
+                        *  28 bits ignore
+                        *  1 bit - 1==product snoozed
+                        *  1 bit - 1==microsoft product
+                        *  1 bit - 1==product up-to-date
+                        *  1 bit - 1==product enabled
+                        */
+                       RDEBUG2("SoH Health-Class-Status - current shid=%08x component=%i", curr_shid, curr_shid_c);
+
+                       if (curr_shid == 0x137 && curr_shid_c == 128) {
+                               char const *s, *t;
+                               uint32_t hcstatus = soh_pull_be_32(data);
+
+                               RDEBUG2("SoH Health-Class-Status microsoft DWORD=%08x", hcstatus);
+
+                               vp = pairmake_packet("SoH-MS-Windows-Health-Status", NULL, T_OP_EQ);
+                               if (!vp) return 0;
+
+                               switch (curr_hc) {
+                               case 4:
+                                       /* security updates */
+                                       s = "security-updates";
+                                       switch (hcstatus) {
+                                       case 0xff0005:
+                                               pairsprintf(vp, "%s ok all-installed", s);
+                                               break;
+
+                                       case 0xff0006:
+                                               pairsprintf(vp, "%s warn some-missing", s);
+                                               break;
+
+                                       case 0xff0008:
+                                               pairsprintf(vp, "%s warn never-started", s);
+                                               break;
+
+                                       case 0xc0ff000c:
+                                               pairsprintf(vp, "%s error no-wsus-srv", s);
+                                               break;
+
+                                       case 0xc0ff000d:
+                                               pairsprintf(vp, "%s error no-wsus-clid", s);
+                                               break;
+
+                                       case 0xc0ff000e:
+                                               pairsprintf(vp, "%s warn wsus-disabled", s);
+                                               break;
+
+                                       case 0xc0ff000f:
+                                               pairsprintf(vp, "%s error comm-failure", s);
+                                               break;
+
+                                       case 0xc0ff0010:
+                                               pairsprintf(vp, "%s warn needs-reboot", s);
+                                               break;
+
+                                       default:
+                                               pairsprintf(vp, "%s error %08x", s, hcstatus);
+                                               break;
+                                       }
+                                       break;
+
+                               case 3:
+                                       /* auto updates */
+                                       s = "auto-updates";
+                                       switch (hcstatus) {
+                                       case 1:
+                                               pairsprintf(vp, "%s warn disabled", s);
+                                               break;
+
+                                       case 2:
+                                               pairsprintf(vp, "%s ok action=check-only", s);
+                                               break;
+
+                                       case 3:
+                                               pairsprintf(vp, "%s ok action=download", s);
+                                               break;
+
+                                       case 4:
+                                               pairsprintf(vp, "%s ok action=install", s);
+                                               break;
+
+                                       case 5:
+                                               pairsprintf(vp, "%s warn unconfigured", s);
+                                               break;
+
+                                       case 0xc0ff0003:
+                                               pairsprintf(vp, "%s warn service-down", s);
+                                               break;
+
+                                       case 0xc0ff0018:
+                                               pairsprintf(vp, "%s warn never-started", s);
+                                               break;
+
+                                       default:
+                                               pairsprintf(vp, "%s error %08x", s, hcstatus);
+                                               break;
+                                       }
+                                       break;
+
+                               default:
+                                       /* other - firewall, antivirus, antispyware */
+                                       s = healthclass2str(curr_hc);
+                                       if (s) {
+                                               /* bah. this is vile. stupid microsoft
+                                                */
+                                               if (hcstatus & 0xff000000) {
+                                                       /* top octet non-zero means an error
+                                                        * FIXME: is this always correct? MS-WSH 2.2.8 is unclear
+                                                        */
+                                                       t = clientstatus2str(hcstatus);
+                                                       if (t) {
+                                                               pairsprintf(vp, "%s error %s", s, t);
                                                        } else {
-                                                               pairsprintf(vp, "%i unknown %08x", curr_hc, hcstatus);
+                                                               pairsprintf(vp, "%s error %08x", s, hcstatus);
                                                        }
-                                                       break;
+                                               } else {
+                                                       pairsprintf(vp,
+                                                                       "%s ok snoozed=%i microsoft=%i up2date=%i enabled=%i",
+                                                                       s,
+                                                                       hcstatus & 0x8 ? 1 : 0,
+                                                                       hcstatus & 0x4 ? 1 : 0,
+                                                                       hcstatus & 0x2 ? 1 : 0,
+                                                                       hcstatus & 0x1 ? 1 : 0
+                                                                       );
+                                               }
+                                       } else {
+                                               pairsprintf(vp, "%i unknown %08x", curr_hc, hcstatus);
                                        }
-                               } else {
-                                       vp = pairmake_packet("SoH-MS-Health-Other", NULL, T_OP_EQ);
-                                       if (!vp) return 0;
-
-                                       /* FIXME: what to do with the payload? */
-                                       pairsprintf(vp, "%08x/%i ?", curr_shid, curr_shid_c);
+                                       break;
                                }
-                               break;
+                       } else {
+                               vp = pairmake_packet("SoH-MS-Health-Other", NULL, T_OP_EQ);
+                               if (!vp) return 0;
 
-                       default:
-                               RDEBUG("SoH Unknown TLV %i len=%i", tlv.tlv_type, tlv.tlv_len);
-                               break;
+                               /* FIXME: what to do with the payload? */
+                               pairsprintf(vp, "%08x/%i ?", curr_shid, curr_shid_c);
+                       }
+                       break;
+
+               default:
+                       RDEBUG("SoH Unknown TLV %i len=%i", tlv.tlv_type, tlv.tlv_len);
+                       break;
                }
 
                data += tlv.tlv_len;
index f782dd1..2f044f6 100644 (file)
@@ -697,15 +697,19 @@ void tls_session_information(tls_session_t *tls_session)
                case SSL3_RT_CHANGE_CIPHER_SPEC:
                        str_content_type = "ChangeCipherSpec";
                        break;
+
                case SSL3_RT_ALERT:
                        str_content_type = "Alert";
                        break;
+
                case SSL3_RT_HANDSHAKE:
                        str_content_type = "Handshake";
                        break;
+
                case SSL3_RT_APPLICATION_DATA:
                        str_content_type = "ApplicationData";
                        break;
+
                default:
                        str_content_type = "UnknownContentType";
                        break;
@@ -730,69 +734,91 @@ void tls_session_information(tls_session_t *tls_session)
                                case SSL3_AD_CLOSE_NOTIFY:
                                        str_details2 = " close_notify";
                                        break;
+
                                case SSL3_AD_UNEXPECTED_MESSAGE:
                                        str_details2 = " unexpected_message";
                                        break;
+
                                case SSL3_AD_BAD_RECORD_MAC:
                                        str_details2 = " bad_record_mac";
                                        break;
+
                                case TLS1_AD_DECRYPTION_FAILED:
                                        str_details2 = " decryption_failed";
                                        break;
+
                                case TLS1_AD_RECORD_OVERFLOW:
                                        str_details2 = " record_overflow";
                                        break;
+
                                case SSL3_AD_DECOMPRESSION_FAILURE:
                                        str_details2 = " decompression_failure";
                                        break;
+
                                case SSL3_AD_HANDSHAKE_FAILURE:
                                        str_details2 = " handshake_failure";
                                        break;
+
                                case SSL3_AD_BAD_CERTIFICATE:
                                        str_details2 = " bad_certificate";
                                        break;
+
                                case SSL3_AD_UNSUPPORTED_CERTIFICATE:
                                        str_details2 = " unsupported_certificate";
                                        break;
+
                                case SSL3_AD_CERTIFICATE_REVOKED:
                                        str_details2 = " certificate_revoked";
                                        break;
+
                                case SSL3_AD_CERTIFICATE_EXPIRED:
                                        str_details2 = " certificate_expired";
                                        break;
+
                                case SSL3_AD_CERTIFICATE_UNKNOWN:
                                        str_details2 = " certificate_unknown";
                                        break;
+
                                case SSL3_AD_ILLEGAL_PARAMETER:
                                        str_details2 = " illegal_parameter";
                                        break;
+
                                case TLS1_AD_UNKNOWN_CA:
                                        str_details2 = " unknown_ca";
                                        break;
+
                                case TLS1_AD_ACCESS_DENIED:
                                        str_details2 = " access_denied";
                                        break;
+
                                case TLS1_AD_DECODE_ERROR:
                                        str_details2 = " decode_error";
                                        break;
+
                                case TLS1_AD_DECRYPT_ERROR:
                                        str_details2 = " decrypt_error";
                                        break;
+
                                case TLS1_AD_EXPORT_RESTRICTION:
                                        str_details2 = " export_restriction";
                                        break;
+
                                case TLS1_AD_PROTOCOL_VERSION:
                                        str_details2 = " protocol_version";
                                        break;
+
                                case TLS1_AD_INSUFFICIENT_SECURITY:
                                        str_details2 = " insufficient_security";
                                        break;
+
                                case TLS1_AD_INTERNAL_ERROR:
                                        str_details2 = " internal_error";
                                        break;
+
                                case TLS1_AD_USER_CANCELLED:
                                        str_details2 = " user_canceled";
                                        break;
+
                                case TLS1_AD_NO_RENEGOTIATION:
                                        str_details2 = " no_renegotiation";
                                        break;
@@ -803,35 +829,43 @@ void tls_session_information(tls_session_t *tls_session)
                if (tls_session->info.content_type == SSL3_RT_HANDSHAKE) {
                        str_details1 = "???";
 
-                       if (tls_session->info.record_len > 0)
-                       switch (tls_session->info.handshake_type) {
+                       if (tls_session->info.record_len > 0) switch (tls_session->info.handshake_type) {
                        case SSL3_MT_HELLO_REQUEST:
                                str_details1 = ", HelloRequest";
                                break;
+
                        case SSL3_MT_CLIENT_HELLO:
                                str_details1 = ", ClientHello";
                                break;
+
                        case SSL3_MT_SERVER_HELLO:
                                str_details1 = ", ServerHello";
                                break;
+
                        case SSL3_MT_CERTIFICATE:
                                str_details1 = ", Certificate";
                                break;
+
                        case SSL3_MT_SERVER_KEY_EXCHANGE:
                                str_details1 = ", ServerKeyExchange";
                                break;
+
                        case SSL3_MT_CERTIFICATE_REQUEST:
                                str_details1 = ", CertificateRequest";
                                break;
+
                        case SSL3_MT_SERVER_DONE:
                                str_details1 = ", ServerHelloDone";
                                break;
+
                        case SSL3_MT_CERTIFICATE_VERIFY:
                                str_details1 = ", CertificateVerify";
                                break;
+
                        case SSL3_MT_CLIENT_KEY_EXCHANGE:
                                str_details1 = ", ClientKeyExchange";
                                break;
+
                        case SSL3_MT_FINISHED:
                                str_details1 = ", Finished";
                                break;
@@ -1773,10 +1807,10 @@ int cbtls_verify(int ok, X509_STORE_CTX *ctx)
        }
 
        switch (ctx->error) {
-
        case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT:
                ERROR("issuer= %s\n", issuer);
                break;
+
        case X509_V_ERR_CERT_NOT_YET_VALID:
        case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD:
                ERROR("notBefore=");
@@ -1784,6 +1818,7 @@ int cbtls_verify(int ok, X509_STORE_CTX *ctx)
                ASN1_TIME_print(bio_err, X509_get_notBefore(ctx->current_cert));
 #endif
                break;
+
        case X509_V_ERR_CERT_HAS_EXPIRED:
        case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD:
                ERROR("notAfter=");
index c4b0a35..b9f64dd 100644 (file)
@@ -178,133 +178,133 @@ static REQUEST *request_setup(FILE *fp)
                }
 
                if (!vp->da->vendor) switch (vp->da->attr) {
-                       default:
-                               break;
+               default:
+                       break;
 
-                               /*
-                                *      Allow it to set the packet type in
-                                *      the attributes read from the file.
-                                */
-                       case PW_PACKET_TYPE:
-                               request->packet->code = vp->vp_integer;
-                               break;
+                       /*
+                        *      Allow it to set the packet type in
+                        *      the attributes read from the file.
+                        */
+               case PW_PACKET_TYPE:
+                       request->packet->code = vp->vp_integer;
+                       break;
 
-                       case PW_PACKET_DST_PORT:
-                               request->packet->dst_port = (vp->vp_integer & 0xffff);
-                               break;
+               case PW_PACKET_DST_PORT:
+                       request->packet->dst_port = (vp->vp_integer & 0xffff);
+                       break;
 
-                       case PW_PACKET_DST_IP_ADDRESS:
-                               request->packet->dst_ipaddr.af = AF_INET;
-                               request->packet->dst_ipaddr.ipaddr.ip4addr.s_addr = vp->vp_ipaddr;
-                               break;
+               case PW_PACKET_DST_IP_ADDRESS:
+                       request->packet->dst_ipaddr.af = AF_INET;
+                       request->packet->dst_ipaddr.ipaddr.ip4addr.s_addr = vp->vp_ipaddr;
+                       break;
 
-                       case PW_PACKET_DST_IPV6_ADDRESS:
-                               request->packet->dst_ipaddr.af = AF_INET6;
-                               request->packet->dst_ipaddr.ipaddr.ip6addr = vp->vp_ipv6addr;
-                               break;
+               case PW_PACKET_DST_IPV6_ADDRESS:
+                       request->packet->dst_ipaddr.af = AF_INET6;
+                       request->packet->dst_ipaddr.ipaddr.ip6addr = vp->vp_ipv6addr;
+                       break;
 
-                       case PW_PACKET_SRC_PORT:
-                               request->packet->src_port = (vp->vp_integer & 0xffff);
-                               break;
+               case PW_PACKET_SRC_PORT:
+                       request->packet->src_port = (vp->vp_integer & 0xffff);
+                       break;
 
-                       case PW_PACKET_SRC_IP_ADDRESS:
-                               request->packet->src_ipaddr.af = AF_INET;
-                               request->packet->src_ipaddr.ipaddr.ip4addr.s_addr = vp->vp_ipaddr;
-                               break;
+               case PW_PACKET_SRC_IP_ADDRESS:
+                       request->packet->src_ipaddr.af = AF_INET;
+                       request->packet->src_ipaddr.ipaddr.ip4addr.s_addr = vp->vp_ipaddr;
+                       break;
 
-                       case PW_PACKET_SRC_IPV6_ADDRESS:
-                               request->packet->src_ipaddr.af = AF_INET6;
-                               request->packet->src_ipaddr.ipaddr.ip6addr = vp->vp_ipv6addr;
-                               break;
+               case PW_PACKET_SRC_IPV6_ADDRESS:
+                       request->packet->src_ipaddr.af = AF_INET6;
+                       request->packet->src_ipaddr.ipaddr.ip6addr = vp->vp_ipv6addr;
+                       break;
+
+               case PW_CHAP_PASSWORD: {
+                       int i, already_hex = 0;
 
-                       case PW_CHAP_PASSWORD: {
-                               int i, already_hex = 0;
-
-                               /*
-                                *      If it's 17 octets, it *might* be already encoded.
-                                *      Or, it might just be a 17-character password (maybe UTF-8)
-                                *      Check it for non-printable characters.  The odds of ALL
-                                *      of the characters being 32..255 is (1-7/8)^17, or (1/8)^17,
-                                *      or 1/(2^51), which is pretty much zero.
-                                */
-                               if (vp->length == 17) {
-                                       for (i = 0; i < 17; i++) {
-                                               if (vp->vp_octets[i] < 32) {
-                                                       already_hex = 1;
-                                                       break;
-                                               }
+                       /*
+                        *      If it's 17 octets, it *might* be already encoded.
+                        *      Or, it might just be a 17-character password (maybe UTF-8)
+                        *      Check it for non-printable characters.  The odds of ALL
+                        *      of the characters being 32..255 is (1-7/8)^17, or (1/8)^17,
+                        *      or 1/(2^51), which is pretty much zero.
+                        */
+                       if (vp->length == 17) {
+                               for (i = 0; i < 17; i++) {
+                                       if (vp->vp_octets[i] < 32) {
+                                               already_hex = 1;
+                                               break;
                                        }
                                }
+                       }
 
-                               /*
-                                *      Allow the user to specify ASCII or hex CHAP-Password
-                                */
-                               if (!already_hex) {
-                                       uint8_t *p;
-                                       size_t len, len2;
+                       /*
+                        *      Allow the user to specify ASCII or hex CHAP-Password
+                        */
+                       if (!already_hex) {
+                               uint8_t *p;
+                               size_t len, len2;
 
-                                       len = len2 = vp->length;
-                                       if (len2 < 17) len2 = 17;
+                               len = len2 = vp->length;
+                               if (len2 < 17) len2 = 17;
 
-                                       p = talloc_zero_array(vp, uint8_t, len2);
+                               p = talloc_zero_array(vp, uint8_t, len2);
 
-                                       memcpy(p, vp->vp_strvalue, len);
+                               memcpy(p, vp->vp_strvalue, len);
 
-                                       rad_chap_encode(request->packet,
-                                                       p,
-                                                       fr_rand() & 0xff, vp);
-                                       vp->vp_octets = p;
-                                       vp->length = 17;
-                               }
+                               rad_chap_encode(request->packet,
+                                               p,
+                                               fr_rand() & 0xff, vp);
+                               vp->vp_octets = p;
+                               vp->length = 17;
                        }
-                               break;
+               }
+                       break;
 
-                       case PW_DIGEST_REALM:
-                       case PW_DIGEST_NONCE:
-                       case PW_DIGEST_METHOD:
-                       case PW_DIGEST_URI:
-                       case PW_DIGEST_QOP:
-                       case PW_DIGEST_ALGORITHM:
-                       case PW_DIGEST_BODY_DIGEST:
-                       case PW_DIGEST_CNONCE:
-                       case PW_DIGEST_NONCE_COUNT:
-                       case PW_DIGEST_USER_NAME:
-                               /* overlapping! */
-                       {
-                               DICT_ATTR const *da;
-                               uint8_t *p, *q;
-
-                               p = talloc_array(vp, uint8_t, vp->length + 2);
-
-                               memcpy(p + 2, vp->vp_octets, vp->length);
-                               p[0] = vp->da->attr - PW_DIGEST_REALM + 1;
-                               vp->length += 2;
-                               p[1] = vp->length;
-
-                               da = dict_attrbyvalue(PW_DIGEST_ATTRIBUTES, 0);
-                               rad_assert(da != NULL);
-                               vp->da = da;
-
-                               /*
-                                *      Re-do pairmemsteal ourselves,
-                                *      because we play games with
-                                *      vp->da, and pairmemsteal goes
-                                *      to GREAT lengths to sanitize
-                                *      and fix and change and
-                                *      double-check the various
-                                *      fields.
-                                */
-                               memcpy(&q, &vp->vp_octets, sizeof(q));
-                               talloc_free(q);
-
-                               vp->vp_octets = talloc_steal(vp, p);
-                               vp->type = VT_DATA;
-
-                               VERIFY_VP(vp);
-                       }
+               case PW_DIGEST_REALM:
+               case PW_DIGEST_NONCE:
+               case PW_DIGEST_METHOD:
+               case PW_DIGEST_URI:
+               case PW_DIGEST_QOP:
+               case PW_DIGEST_ALGORITHM:
+               case PW_DIGEST_BODY_DIGEST:
+               case PW_DIGEST_CNONCE:
+               case PW_DIGEST_NONCE_COUNT:
+               case PW_DIGEST_USER_NAME:
+                       /* overlapping! */
+               {
+                       DICT_ATTR const *da;
+                       uint8_t *p, *q;
+
+                       p = talloc_array(vp, uint8_t, vp->length + 2);
+
+                       memcpy(p + 2, vp->vp_octets, vp->length);
+                       p[0] = vp->da->attr - PW_DIGEST_REALM + 1;
+                       vp->length += 2;
+                       p[1] = vp->length;
+
+                       da = dict_attrbyvalue(PW_DIGEST_ATTRIBUTES, 0);
+                       rad_assert(da != NULL);
+                       vp->da = da;
 
-                       break;
-                       }
+                       /*
+                        *      Re-do pairmemsteal ourselves,
+                        *      because we play games with
+                        *      vp->da, and pairmemsteal goes
+                        *      to GREAT lengths to sanitize
+                        *      and fix and change and
+                        *      double-check the various
+                        *      fields.
+                        */
+                       memcpy(&q, &vp->vp_octets, sizeof(q));
+                       talloc_free(q);
+
+                       vp->vp_octets = talloc_steal(vp, p);
+                       vp->type = VT_DATA;
+
+                       VERIFY_VP(vp);
+               }
+
+               break;
+               }
        } /* loop over the VP's we read in */
 
        if (debug_flag) {
index c9d8b23..cdbe5af 100644 (file)
@@ -971,21 +971,21 @@ int radius_request(REQUEST **context, request_refs_t name)
        REQUEST *request = *context;
 
        switch (name) {
-               case REQUEST_CURRENT:
-                       return 0;
+       case REQUEST_CURRENT:
+               return 0;
 
-               case REQUEST_PARENT:    /* for future use in request chaining */
-               case REQUEST_OUTER:
-                       if (!request->parent) {
-                               return -1;
-                       }
-                       *context = request->parent;
-                       break;
-
-               case REQUEST_UNKNOWN:
-               default:
-                       rad_assert(0);
+       case REQUEST_PARENT:    /* for future use in request chaining */
+       case REQUEST_OUTER:
+               if (!request->parent) {
                        return -1;
+               }
+               *context = request->parent;
+               break;
+
+       case REQUEST_UNKNOWN:
+       default:
+               rad_assert(0);
+               return -1;
        }
 
        return 0;
index 1ae0cf7..a29630b 100644 (file)
@@ -445,38 +445,38 @@ int paircompare(REQUEST *request, VALUE_PAIR *req_list, VALUE_PAIR *check,
                }
 
                if (!check_item->da->vendor) switch (check_item->da->attr) {
-                       /*
-                        *      Attributes we skip during comparison.
-                        *      These are "server" check items.
-                        */
-                       case PW_CRYPT_PASSWORD:
-                       case PW_AUTH_TYPE:
-                       case PW_AUTZ_TYPE:
-                       case PW_ACCT_TYPE:
-                       case PW_SESSION_TYPE:
-                       case PW_STRIP_USER_NAME:
-                               continue;
-                               break;
+               /*
+                *      Attributes we skip during comparison.
+                *      These are "server" check items.
+                */
+               case PW_CRYPT_PASSWORD:
+               case PW_AUTH_TYPE:
+               case PW_AUTZ_TYPE:
+               case PW_ACCT_TYPE:
+               case PW_SESSION_TYPE:
+               case PW_STRIP_USER_NAME:
+                       continue;
+                       break;
 
-                       /*
-                        *      IF the password attribute exists, THEN
-                        *      we can do comparisons against it.  If not,
-                        *      then the request did NOT contain a
-                        *      User-Password attribute, so we CANNOT do
-                        *      comparisons against it.
-                        *
-                        *      This hack makes CHAP-Password work..
-                        */
-                       case PW_USER_PASSWORD:
-                               if (check_item->op == T_OP_CMP_EQ) {
-                                       WARN("Found User-Password == \"...\"");
-                                       WARN("Are you sure you don't mean Cleartext-Password?");
-                                       WARN("See \"man rlm_pap\" for more information");
-                               }
-                               if (pairfind(req_list, PW_USER_PASSWORD, 0, TAG_ANY) == NULL) {
-                                       continue;
-                               }
-                               break;
+               /*
+                *      IF the password attribute exists, THEN
+                *      we can do comparisons against it.  If not,
+                *      then the request did NOT contain a
+                *      User-Password attribute, so we CANNOT do
+                *      comparisons against it.
+                *
+                *      This hack makes CHAP-Password work..
+                */
+               case PW_USER_PASSWORD:
+                       if (check_item->op == T_OP_CMP_EQ) {
+                               WARN("Found User-Password == \"...\"");
+                               WARN("Are you sure you don't mean Cleartext-Password?");
+                               WARN("See \"man rlm_pap\" for more information");
+                       }
+                       if (pairfind(req_list, PW_USER_PASSWORD, 0, TAG_ANY) == NULL) {
+                               continue;
+                       }
+                       break;
                }
 
                /*
@@ -532,42 +532,42 @@ int paircompare(REQUEST *request, VALUE_PAIR *req_list, VALUE_PAIR *check,
                                                  check_item, check, rep_list);
 
                switch (check_item->op) {
-                       case T_OP_EQ:
-                       default:
-                               RWDEBUG("Invalid operator '%s' for item %s: reverting to '=='",
-                                       fr_int2str(fr_tokens, check_item->op, "<INVALID>"), check_item->da->name);
-                               /* FALL-THROUGH */
-                       case T_OP_CMP_TRUE:
-                       case T_OP_CMP_FALSE:
-                       case T_OP_CMP_EQ:
-                               if (compare != 0) result = -1;
-                               break;
+               case T_OP_EQ:
+               default:
+                       RWDEBUG("Invalid operator '%s' for item %s: reverting to '=='",
+                               fr_int2str(fr_tokens, check_item->op, "<INVALID>"), check_item->da->name);
+                       /* FALL-THROUGH */
+               case T_OP_CMP_TRUE:
+               case T_OP_CMP_FALSE:
+               case T_OP_CMP_EQ:
+                       if (compare != 0) result = -1;
+                       break;
 
-                       case T_OP_NE:
-                               if (compare == 0) result = -1;
-                               break;
+               case T_OP_NE:
+                       if (compare == 0) result = -1;
+                       break;
 
-                       case T_OP_LT:
-                               if (compare >= 0) result = -1;
-                               break;
+               case T_OP_LT:
+                       if (compare >= 0) result = -1;
+                       break;
 
-                       case T_OP_GT:
-                               if (compare <= 0) result = -1;
-                               break;
+               case T_OP_GT:
+                       if (compare <= 0) result = -1;
+                       break;
 
-                       case T_OP_LE:
-                               if (compare > 0) result = -1;
-                               break;
+               case T_OP_LE:
+                       if (compare > 0) result = -1;
+                       break;
 
-                       case T_OP_GE:
-                               if (compare < 0) result = -1;
-                               break;
+               case T_OP_GE:
+                       if (compare < 0) result = -1;
+                       break;
 
 #ifdef HAVE_REGEX_H
-                       case T_OP_REG_EQ:
-                       case T_OP_REG_NE:
-                               if (compare != 0) result = -1;
-                               break;
+               case T_OP_REG_EQ:
+               case T_OP_REG_NE:
+                       if (compare != 0) result = -1;
+                       break;
 #endif
                } /* switch over the operator of the check item */
 
@@ -725,58 +725,58 @@ VALUE_PAIR **radius_list(REQUEST *request, pair_lists_t list)
        if (!request) return NULL;
 
        switch (list) {
-               case PAIR_LIST_UNKNOWN:
-               default:
-                       break;
+       case PAIR_LIST_UNKNOWN:
+       default:
+               break;
 
-               case PAIR_LIST_REQUEST:
-                       return &request->packet->vps;
+       case PAIR_LIST_REQUEST:
+               return &request->packet->vps;
 
-               case PAIR_LIST_REPLY:
-                       return &request->reply->vps;
+       case PAIR_LIST_REPLY:
+               return &request->reply->vps;
 
-               case PAIR_LIST_CONTROL:
-                       return &request->config_items;
+       case PAIR_LIST_CONTROL:
+               return &request->config_items;
 
 #ifdef WITH_PROXY
-               case PAIR_LIST_PROXY_REQUEST:
-                       if (!request->proxy) break;
-                       return &request->proxy->vps;
+       case PAIR_LIST_PROXY_REQUEST:
+               if (!request->proxy) break;
+               return &request->proxy->vps;
 
-               case PAIR_LIST_PROXY_REPLY:
-                       if (!request->proxy) break;
-                       return &request->proxy_reply->vps;
+       case PAIR_LIST_PROXY_REPLY:
+               if (!request->proxy) break;
+               return &request->proxy_reply->vps;
 #endif
 #ifdef WITH_COA
-               case PAIR_LIST_COA:
-                       if (request->coa &&
-                           (request->coa->proxy->code == PW_CODE_COA_REQUEST)) {
-                               return &request->coa->proxy->vps;
-                       }
-                       break;
+       case PAIR_LIST_COA:
+               if (request->coa &&
+                   (request->coa->proxy->code == PW_CODE_COA_REQUEST)) {
+                       return &request->coa->proxy->vps;
+               }
+               break;
 
-               case PAIR_LIST_COA_REPLY:
-                       if (request->coa && /* match reply with request */
-                           (request->coa->proxy->code == PW_CODE_COA_REQUEST) &&
-                           request->coa->proxy_reply) {
-                               return &request->coa->proxy_reply->vps;
-                       }
-                       break;
+       case PAIR_LIST_COA_REPLY:
+               if (request->coa && /* match reply with request */
+                   (request->coa->proxy->code == PW_CODE_COA_REQUEST) &&
+                   request->coa->proxy_reply) {
+                       return &request->coa->proxy_reply->vps;
+               }
+               break;
 
-               case PAIR_LIST_DM:
-                       if (request->coa &&
-                           (request->coa->proxy->code == PW_CODE_DISCONNECT_REQUEST)) {
-                               return &request->coa->proxy->vps;
-                       }
-                       break;
+       case PAIR_LIST_DM:
+               if (request->coa &&
+                   (request->coa->proxy->code == PW_CODE_DISCONNECT_REQUEST)) {
+                       return &request->coa->proxy->vps;
+               }
+               break;
 
-               case PAIR_LIST_DM_REPLY:
-                       if (request->coa && /* match reply with request */
-                           (request->coa->proxy->code == PW_CODE_DISCONNECT_REQUEST) &&
-                           request->coa->proxy_reply) {
-                               return &request->coa->proxy->vps;
-                       }
-                       break;
+       case PAIR_LIST_DM_REPLY:
+               if (request->coa && /* match reply with request */
+                   (request->coa->proxy->code == PW_CODE_DISCONNECT_REQUEST) &&
+                   request->coa->proxy_reply) {
+                       return &request->coa->proxy->vps;
+               }
+               break;
 #endif
        }
 
@@ -853,68 +853,68 @@ void radius_map_debug(REQUEST *request, value_pair_map_t const *map, VALUE_PAIR
        rad_assert(vp || (map->src->type == VPT_TYPE_NULL));
 
        switch (map->src->type) {
-               /*
-                *      Just print the value being assigned
-                */
-               default:
-               case VPT_TYPE_LITERAL:
-                       vp_prints_value(buffer, sizeof(buffer), vp, '\'');
-                       value = buffer;
-                       break;
+       /*
+        *      Just print the value being assigned
+        */
+       default:
+       case VPT_TYPE_LITERAL:
+               vp_prints_value(buffer, sizeof(buffer), vp, '\'');
+               value = buffer;
+               break;
 
-               case VPT_TYPE_XLAT:
-               case VPT_TYPE_XLAT_STRUCT:
-                       vp_prints_value(buffer, sizeof(buffer), vp, '"');
-                       value = buffer;
-                       break;
+       case VPT_TYPE_XLAT:
+       case VPT_TYPE_XLAT_STRUCT:
+               vp_prints_value(buffer, sizeof(buffer), vp, '"');
+               value = buffer;
+               break;
 
-               case VPT_TYPE_DATA:
-                       vp_prints_value(buffer, sizeof(buffer), vp, '\'');
-                       value = buffer;
-                       break;
+       case VPT_TYPE_DATA:
+               vp_prints_value(buffer, sizeof(buffer), vp, '\'');
+               value = buffer;
+               break;
 
-               /*
-                *      Just printing the value doesn't make sense, but we still
-                *      want to know what it was...
-                */
-               case VPT_TYPE_LIST:
-                       vp_prints_value(buffer, sizeof(buffer), vp, '\'');
+       /*
+        *      Just printing the value doesn't make sense, but we still
+        *      want to know what it was...
+        */
+       case VPT_TYPE_LIST:
+               vp_prints_value(buffer, sizeof(buffer), vp, '\'');
 
-                       if (map->src->vpt_request == REQUEST_OUTER) {
-                               value = talloc_typed_asprintf(request, "&outer.%s:%s -> %s",
-                                                             fr_int2str(pair_lists, map->src->vpt_list, "<INVALID>"),
-                                                             vp->da->name, buffer);
-                       } else {
-                               value = talloc_typed_asprintf(request, "&%s:%s -> %s",
-                                                             fr_int2str(pair_lists, map->src->vpt_list, "<INVALID>"),
-                                                             vp->da->name, buffer);
-                       }
-                       break;
+               if (map->src->vpt_request == REQUEST_OUTER) {
+                       value = talloc_typed_asprintf(request, "&outer.%s:%s -> %s",
+                                                     fr_int2str(pair_lists, map->src->vpt_list, "<INVALID>"),
+                                                     vp->da->name, buffer);
+               } else {
+                       value = talloc_typed_asprintf(request, "&%s:%s -> %s",
+                                                     fr_int2str(pair_lists, map->src->vpt_list, "<INVALID>"),
+                                                     vp->da->name, buffer);
+               }
+               break;
 
-               case VPT_TYPE_ATTR:
-                       vp_prints_value(buffer, sizeof(buffer), vp, '\'');
-                       value = talloc_typed_asprintf(request, "&%s -> %s", map->src->vpt_da->name, buffer);
-                       break;
+       case VPT_TYPE_ATTR:
+               vp_prints_value(buffer, sizeof(buffer), vp, '\'');
+               value = talloc_typed_asprintf(request, "&%s -> %s", map->src->vpt_da->name, buffer);
+               break;
 
-               case VPT_TYPE_NULL:
-                       strcpy(buffer, "ANY");
-                       value = buffer;
-                       break;
+       case VPT_TYPE_NULL:
+               strcpy(buffer, "ANY");
+               value = buffer;
+               break;
        }
 
        switch (map->dst->type) {
-               case VPT_TYPE_LIST:
-                       RDEBUG("\t%s%s %s %s", map->dst->name, vp ? vp->da->name : "",
-                              fr_int2str(fr_tokens, vp ? vp->op : map->op, "<INVALID>"), value);
-                       break;
+       case VPT_TYPE_LIST:
+               RDEBUG("\t%s%s %s %s", map->dst->name, vp ? vp->da->name : "",
+                      fr_int2str(fr_tokens, vp ? vp->op : map->op, "<INVALID>"), value);
+               break;
 
-               case VPT_TYPE_ATTR:
-                       RDEBUG("\t%s %s %s", map->dst->name,
-                              fr_int2str(fr_tokens, vp ? vp->op : map->op, "<INVALID>"), value);
-                       break;
+       case VPT_TYPE_ATTR:
+               RDEBUG("\t%s %s %s", map->dst->name,
+                      fr_int2str(fr_tokens, vp ? vp->op : map->op, "<INVALID>"), value);
+               break;
 
-               default:
-                       break;
+       default:
+               break;
        }
 
        if (value != buffer) talloc_free(value);
@@ -1346,8 +1346,8 @@ int radius_mapexec(VALUE_PAIR **out, REQUEST *request, value_pair_map_t const *m
                        return -2;
                }
                *out = output_pairs;
-
                return 0;
+
        case VPT_TYPE_ATTR:
        {
                VALUE_PAIR *vp;
@@ -1363,6 +1363,7 @@ int radius_mapexec(VALUE_PAIR **out, REQUEST *request, value_pair_map_t const *m
 
                return 0;
        }
+
        default:
                rad_assert(0);
        }
@@ -1437,6 +1438,7 @@ int radius_map2vp(VALUE_PAIR **out, REQUEST *request, value_pair_map_t const *ma
                if (!vp) return -1;
                vp->op = map->op;
                break;
+
        default:
                break;
        }
@@ -1766,7 +1768,6 @@ int radius_tmpl_copy_vp(VALUE_PAIR **out, REQUEST *request, value_pair_tmpl_t co
 
        case VPT_TYPE_LIST:
                vp = paircopy(request, *vps);
-
                break;
 
        default:
index 118fe5e..3dcf9a1 100644 (file)
@@ -442,17 +442,17 @@ static ssize_t xlat_string(UNUSED void *instance, REQUEST *request,
        }
 
        switch (vp->da->type) {
-               case PW_TYPE_OCTETS:
-                       len = fr_print_string((char const *) p, vp->length, out, outlen);
-                       break;
+       case PW_TYPE_OCTETS:
+               len = fr_print_string((char const *) p, vp->length, out, outlen);
+               break;
 
-               case PW_TYPE_STRING:
-                       len = strlcpy(out, vp->vp_strvalue, outlen);
-                       break;
+       case PW_TYPE_STRING:
+               len = strlcpy(out, vp->vp_strvalue, outlen);
+               break;
 
-               default:
-                       len = fr_print_string((char const *) p, ret, out, outlen);
-                       break;
+       default:
+               len = fr_print_string((char const *) p, ret, out, outlen);
+               break;
        }
 
        return len;
@@ -1125,54 +1125,54 @@ static ssize_t xlat_tokenize_literal(TALLOC_CTX *ctx, char *fmt, xlat_exp_t **he
                 *      Convert \n to it's literal representation.
                 */
                if (p[0] == '\\') switch (p[1]) {
-                       case 't':
-                               *(q++) = '\t';
-                               p += 2;
-                               node->len++;
-                               continue;
-
-                       case 'n':
-                               *(q++) = '\n';
-                               p += 2;
-                               node->len++;
-                               continue;
-
-                       case 'x':
-                               p += 2;
-                               if (!p[0] || !p[1]) {
-                                       talloc_free(node);
-                                       *error = "Hex expansion requires two hex digits";
-                                       return -(p - fmt);
-                               }
+               case 't':
+                       *(q++) = '\t';
+                       p += 2;
+                       node->len++;
+                       continue;
 
-                               if (!fr_hex2bin((uint8_t *) q, 1, p, 2)) {
-                                       talloc_free(node);
-                                       *error = "Invalid hex characters";
-                                       return -(p - fmt);
-                               }
+               case 'n':
+                       *(q++) = '\n';
+                       p += 2;
+                       node->len++;
+                       continue;
 
-                               /*
-                                *      Don't let people shoot themselves in the foot.
-                                *      \x00 is forbidden.
-                                */
-                               if (!*q) {
-                                       talloc_free(node);
-                                       *error = "Cannot add zero byte to printable string";
-                                       return -(p - fmt);
-                               }
+               case 'x':
+                       p += 2;
+                       if (!p[0] || !p[1]) {
+                               talloc_free(node);
+                               *error = "Hex expansion requires two hex digits";
+                               return -(p - fmt);
+                       }
 
-                               p += 2;
-                               q++;
-                               node->len++;
-                               continue;
+                       if (!fr_hex2bin((uint8_t *) q, 1, p, 2)) {
+                               talloc_free(node);
+                               *error = "Invalid hex characters";
+                               return -(p - fmt);
+                       }
 
-                       default:
-                               *(q++) = *p;
-                               p += 2;
-                               node->len++;
-                               continue;
+                       /*
+                        *      Don't let people shoot themselves in the foot.
+                        *      \x00 is forbidden.
+                        */
+                       if (!*q) {
+                               talloc_free(node);
+                               *error = "Cannot add zero byte to printable string";
+                               return -(p - fmt);
                        }
 
+                       p += 2;
+                       q++;
+                       node->len++;
+                       continue;
+
+               default:
+                       *(q++) = *p;
+                       p += 2;
+                       node->len++;
+                       continue;
+               }
+
                /*
                 *      Process the expansion.
                 */
index 353d4a1..bf97f9a 100644 (file)
@@ -375,6 +375,7 @@ static rlm_cache_entry_t *cache_add(rlm_cache_t *inst, REQUEST *request, char co
                        case PW_CACHE_ENTRY_HITS:
                                RDEBUG2("Skipping %s", vp->da->name);
                                continue;
+
                        default:
                                break;
                        }
index cf5e876..c68fe8d 100644 (file)
@@ -61,32 +61,35 @@ void couchbase_get_callback(lcb_t instance, const void *cookie, lcb_error_t erro
 
        /* check error */
        switch (error) {
-               case LCB_SUCCESS:
-                       /* check for valid bytes */
-                       if (bytes && nbytes > 1) {
-                               /* debug */
-                               DEBUG("rlm_couchbase: (get_callback) got %zu bytes", nbytes);
-                               /* build json object */
-                               c->jobj = json_tokener_parse_verbose(bytes, &c->jerr);
-                               /* switch on current error status */
-                               switch (c->jerr) {
-                                       case json_tokener_success:
-                                               /* do nothing */
-                                       break;
-                                       default:
-                                               /* log error */
-                                               ERROR("rlm_couchbase: (get_callback) JSON Tokener error: %s", json_tokener_error_desc(c->jerr));
-                                       break;
-                               }
+       case LCB_SUCCESS:
+               /* check for valid bytes */
+               if (bytes && nbytes > 1) {
+                       /* debug */
+                       DEBUG("rlm_couchbase: (get_callback) got %zu bytes", nbytes);
+                       /* build json object */
+                       c->jobj = json_tokener_parse_verbose(bytes, &c->jerr);
+                       /* switch on current error status */
+                       switch (c->jerr) {
+                       case json_tokener_success:
+                               /* do nothing */
+                               break;
+
+                       default:
+                               /* log error */
+                               ERROR("rlm_couchbase: (get_callback) JSON Tokener error: %s", json_tokener_error_desc(c->jerr));
+                               break;
                        }
+               }
                break;
-               case LCB_KEY_ENOENT:
-                       /* ignored */
-                       DEBUG("rlm_couchbase: (get_callback) key does not exist");
+
+       case LCB_KEY_ENOENT:
+               /* ignored */
+               DEBUG("rlm_couchbase: (get_callback) key does not exist");
                break;
-               default:
-                       /* log error */
-                       ERROR("rlm_couchbase: (get_callback) %s (0x%x)", lcb_strerror(instance, error), error);
+
+       default:
+               /* log error */
+               ERROR("rlm_couchbase: (get_callback) %s (0x%x)", lcb_strerror(instance, error), error);
                break;
        }
 }
index 5f9d606..cc14677 100644 (file)
@@ -244,29 +244,31 @@ void *mod_json_object_to_value_pairs(json_object *json, const char *section, REQ
                                json_object_object_get_ex(json_vp, "op", &jop)) {
                                /* make correct pairs based on json object type */
                                switch (json_object_get_type(jval)) {
-                                       case json_type_double:
-                                       case json_type_int:
-                                       case json_type_string:
-                                               /* debugging */
-                                               RDEBUG("adding '%s' attribute to '%s' section", attribute, section);
-                                               /* add pair */
-                                               vp = pairmake(ctx, ptr, attribute, json_object_get_string(jval),
-                                                       fr_str2int(fr_tokens, json_object_get_string(jop), 0));
-                                               /* check pair */
-                                               if (!vp) {
-                                                       RERROR("could not build value pair for '%s' attribute (%s)", attribute, fr_strerror());
-                                                       /* return */
-                                                       return NULL;
-                                               }
+                               case json_type_double:
+                               case json_type_int:
+                               case json_type_string:
+                                       /* debugging */
+                                       RDEBUG("adding '%s' attribute to '%s' section", attribute, section);
+                                       /* add pair */
+                                       vp = pairmake(ctx, ptr, attribute, json_object_get_string(jval),
+                                               fr_str2int(fr_tokens, json_object_get_string(jop), 0));
+                                       /* check pair */
+                                       if (!vp) {
+                                               RERROR("could not build value pair for '%s' attribute (%s)", attribute, fr_strerror());
+                                               /* return */
+                                               return NULL;
+                                       }
                                        break;
-                                       case json_type_object:
-                                       case json_type_array:
-                                               /* log error - we want to handle these eventually */
-                                               RERROR("skipping unhandled nested json object or array value pair object");
+
+                               case json_type_object:
+                               case json_type_array:
+                                       /* log error - we want to handle these eventually */
+                                       RERROR("skipping unhandled nested json object or array value pair object");
                                        break;
-                                       default:
-                                               /* log error - this shouldn't ever happen */
-                                               RERROR("skipping unhandled json type in value pair object");
+
+                               default:
+                                       /* log error - this shouldn't ever happen */
+                                       RERROR("skipping unhandled json type in value pair object");
                                        break;
                                }
                        } else {
@@ -295,67 +297,67 @@ json_object *mod_value_pair_to_json_object(REQUEST *request, VALUE_PAIR *vp)
        /* add this attribute/value pair to our json output */
        if (!vp->da->flags.has_tag) {
                switch (vp->da->type) {
-                       case PW_TYPE_INTEGER:
-                       case PW_TYPE_BYTE:
-                       case PW_TYPE_SHORT:
-                               /* skip if we have flags */
-                               if (vp->da->flags.has_value) break;
+               case PW_TYPE_INTEGER:
+               case PW_TYPE_BYTE:
+               case PW_TYPE_SHORT:
+                       /* skip if we have flags */
+                       if (vp->da->flags.has_value) break;
 #ifdef HAVE_JSON_OBJECT_NEW_INT64
-                               /* debug */
-                               RDEBUG3("creating new int64 for unsigned 32 bit int/byte/short '%s'", vp->da->name);
-                               /* return as 64 bit int - JSON spec does not support unsigned ints */
-                               return json_object_new_int64(vp->vp_integer);
+                       /* debug */
+                       RDEBUG3("creating new int64 for unsigned 32 bit int/byte/short '%s'", vp->da->name);
+                       /* return as 64 bit int - JSON spec does not support unsigned ints */
+                       return json_object_new_int64(vp->vp_integer);
 #else
-                               /* debug */
-                               RDEBUG3("creating new int for unsigned 32 bit int/byte/short '%s'", vp->da->name);
-                               /* return as 64 bit int - JSON spec does not support unsigned ints */
-                               return json_object_new_int(vp->vp_integer);
+                       /* debug */
+                       RDEBUG3("creating new int for unsigned 32 bit int/byte/short '%s'", vp->da->name);
+                       /* return as 64 bit int - JSON spec does not support unsigned ints */
+                       return json_object_new_int(vp->vp_integer);
 #endif
-                       break;
-                       case PW_TYPE_SIGNED:
+               break;
+               case PW_TYPE_SIGNED:
 #ifdef HAVE_JSON_OBJECT_NEW_INT64
-                               /* debug */
-                               RDEBUG3("creating new int64 for signed 32 bit integer '%s'", vp->da->name);
-                               /* return as 64 bit int - json-c represents all ints as 64 bits internally */
-                               return json_object_new_int64(vp->vp_signed);
+                       /* debug */
+                       RDEBUG3("creating new int64 for signed 32 bit integer '%s'", vp->da->name);
+                       /* return as 64 bit int - json-c represents all ints as 64 bits internally */
+                       return json_object_new_int64(vp->vp_signed);
 #else
-                               RDEBUG3("creating new int for signed 32 bit integer '%s'", vp->da->name);
-                               /* return as signed int */
-                               return json_object_new_int(vp->vp_signed);
+                       RDEBUG3("creating new int for signed 32 bit integer '%s'", vp->da->name);
+                       /* return as signed int */
+                       return json_object_new_int(vp->vp_signed);
 #endif
-                       break;
-                       case PW_TYPE_INTEGER64:
+               break;
+               case PW_TYPE_INTEGER64:
 #ifdef HAVE_JSON_OBJECT_NEW_INT64
-                               /* debug */
-                               RDEBUG3("creating new int64 for 64 bit integer '%s'", vp->da->name);
-                               /* return as 64 bit int - because it is a 64 bit int */
-                               return json_object_new_int64(vp->vp_integer64);
+                       /* debug */
+                       RDEBUG3("creating new int64 for 64 bit integer '%s'", vp->da->name);
+                       /* return as 64 bit int - because it is a 64 bit int */
+                       return json_object_new_int64(vp->vp_integer64);
 #else
-                               /* warning */
-                               RWARN("skipping 64 bit integer attribute '%s' - please upgrade json-c to 0.10+", vp->da->name);
+                       /* warning */
+                       RWARN("skipping 64 bit integer attribute '%s' - please upgrade json-c to 0.10+", vp->da->name);
 #endif
-                       break;
-                       default:
-                               /* silence warnings - do nothing */
-                       break;
+               break;
+               default:
+                       /* silence warnings - do nothing */
+               break;
                }
        }
 
        /* keep going if not set above */
        switch (vp->da->type) {
-               case PW_TYPE_STRING:
-                       /* debug */
-                       RDEBUG3("assigning string '%s' as string", vp->da->name);
-                       /* return string value */
-                       return json_object_new_string(vp->vp_strvalue);
-               default:
-                       /* debug */
-                       RDEBUG3("assigning unhandled '%s' as string", vp->da->name);
-                       /* get standard value */
-                       vp_prints_value(value, sizeof(value), vp, 0);
-                       /* return string value from above */
-                       return json_object_new_string(value);
-               break;
+       case PW_TYPE_STRING:
+               /* debug */
+               RDEBUG3("assigning string '%s' as string", vp->da->name);
+               /* return string value */
+               return json_object_new_string(vp->vp_strvalue);
+
+       default:
+               /* debug */
+               RDEBUG3("assigning unhandled '%s' as string", vp->da->name);
+               /* get standard value */
+               vp_prints_value(value, sizeof(value), vp, 0);
+               /* return string value from above */
+               return json_object_new_string(value);
        }
 }
 
index 67408a1..b8a0e6f 100644 (file)
@@ -327,7 +327,8 @@ static rlm_rcode_t CC_HINT(nonnull) mod_accounting(void *instance, REQUEST *requ
                                /* add to json object */
                                json_object_object_add(cookie->jobj, "startTimestamp", mod_value_pair_to_json_object(request, vp));
                        }
-               break;
+                       break;
+
                case PW_STATUS_STOP:
                        /* add stop time */
                        if ((vp = pairfind(request->packet->vps, PW_EVENT_TIMESTAMP, 0, TAG_ANY)) != NULL) {
@@ -336,11 +337,13 @@ static rlm_rcode_t CC_HINT(nonnull) mod_accounting(void *instance, REQUEST *requ
                        }
                        /* check start timestamp and adjust if needed */
                        mod_ensure_start_timestamp(cookie->jobj, request->packet->vps);
-               break;
+                       break;
+
                case PW_STATUS_ALIVE:
                        /* check start timestamp and adjust if needed */
                        mod_ensure_start_timestamp(cookie->jobj, request->packet->vps);
-               break;
+                       break;
+
                default:
                        /* we shouldn't get here - free json object */
                        if (cookie->jobj) {
index 37fc1ab..2a92b56 100644 (file)
@@ -377,134 +377,133 @@ static int CC_HINT(nonnull) mschapv2_authenticate(void *arg, eap_handler_t *hand
        ccode = eap_ds->response->type.data[0];
 
        switch (data->code) {
-               case PW_EAP_MSCHAPV2_FAILURE:
-                       if (ccode == PW_EAP_MSCHAPV2_RESPONSE) {
-                               RDEBUG2("authentication re-try from client after we sent a failure");
-                               break;
-                       }
-
-                       /*
-                        * if we sent error 648 (password expired) to the client
-                        * we might get an MSCHAP-CPW packet here; turn it into a
-                        * regular MS-CHAP2-CPW packet and pass it to rlm_mschap
-                        * (or proxy it, I guess)
-                        */
-                       if (ccode == PW_EAP_MSCHAPV2_CHGPASSWD) {
-                               VALUE_PAIR *cpw;
-                               int mschap_id = eap_ds->response->type.data[1];
-                               int copied=0,seq=1;
-
-                               RDEBUG2("password change packet received");
-
-                               challenge = pairmake_packet("MS-CHAP-Challenge", NULL, T_OP_EQ);
-                               if (!challenge) {
-                                       return 0;
-                               }
-                               pairmemcpy(challenge, data->challenge, MSCHAPV2_CHALLENGE_LEN);
+       case PW_EAP_MSCHAPV2_FAILURE:
+               if (ccode == PW_EAP_MSCHAPV2_RESPONSE) {
+                       RDEBUG2("authentication re-try from client after we sent a failure");
+                       break;
+               }
 
-                               cpw = pairmake_packet("MS-CHAP2-CPW", NULL, T_OP_EQ);
-                               cpw->length = 68;
+               /*
+                * if we sent error 648 (password expired) to the client
+                * we might get an MSCHAP-CPW packet here; turn it into a
+                * regular MS-CHAP2-CPW packet and pass it to rlm_mschap
+                * (or proxy it, I guess)
+                */
+               if (ccode == PW_EAP_MSCHAPV2_CHGPASSWD) {
+                       VALUE_PAIR *cpw;
+                       int mschap_id = eap_ds->response->type.data[1];
+                       int copied=0,seq=1;
 
-                               cpw->vp_octets = p = talloc_array(cpw, uint8_t, cpw->length);
-                               p[0] = 7;
-                               p[1] = mschap_id;
-                               memcpy(p + 2, eap_ds->response->type.data + 520, 66);
+                       RDEBUG2("password change packet received");
 
-                               /*
-                                * break the encoded password into VPs (3 of them)
-                                */
-                               while (copied < 516) {
-                                       VALUE_PAIR *nt_enc;
+                       challenge = pairmake_packet("MS-CHAP-Challenge", NULL, T_OP_EQ);
+                       if (!challenge) {
+                               return 0;
+                       }
+                       pairmemcpy(challenge, data->challenge, MSCHAPV2_CHALLENGE_LEN);
 
-                                       int to_copy = 516 - copied;
-                                       if (to_copy > 243)
-                                               to_copy = 243;
+                       cpw = pairmake_packet("MS-CHAP2-CPW", NULL, T_OP_EQ);
+                       cpw->length = 68;
 
-                                       nt_enc = pairmake_packet("MS-CHAP-NT-Enc-PW", NULL, T_OP_ADD);
-                                       nt_enc->length = 4 + to_copy;
+                       cpw->vp_octets = p = talloc_array(cpw, uint8_t, cpw->length);
+                       p[0] = 7;
+                       p[1] = mschap_id;
+                       memcpy(p + 2, eap_ds->response->type.data + 520, 66);
 
-                                       nt_enc->vp_octets = p = talloc_array(nt_enc, uint8_t, nt_enc->length);
+                       /*
+                        * break the encoded password into VPs (3 of them)
+                        */
+                       while (copied < 516) {
+                               VALUE_PAIR *nt_enc;
 
-                                       p[0] = 6;
-                                       p[1] = mschap_id;
-                                       p[2] = 0;
-                                       p[3] = seq++;
+                               int to_copy = 516 - copied;
+                               if (to_copy > 243)
+                                       to_copy = 243;
 
-                                       memcpy(p + 4, eap_ds->response->type.data + 4 + copied, to_copy);
-                                       copied += to_copy;
-                               }
+                               nt_enc = pairmake_packet("MS-CHAP-NT-Enc-PW", NULL, T_OP_ADD);
+                               nt_enc->length = 4 + to_copy;
 
-                               RDEBUG2("built change password packet");
-                               debug_pair_list(request->packet->vps);
+                               nt_enc->vp_octets = p = talloc_array(nt_enc, uint8_t, nt_enc->length);
 
-                               /*
-                                * jump to "authentication"
-                                */
-                               goto packet_ready;
-                       }
+                               p[0] = 6;
+                               p[1] = mschap_id;
+                               p[2] = 0;
+                               p[3] = seq++;
 
-                       /*
-                        * we sent a failure and are expecting a failure back
-                        */
-                       if (ccode != PW_EAP_MSCHAPV2_FAILURE) {
-                               REDEBUG("Sent FAILURE expecting FAILURE but got %d", ccode);
-                               return 0;
+                               memcpy(p + 4, eap_ds->response->type.data + 4 + copied, to_copy);
+                               copied += to_copy;
                        }
 
-       failure:
-                       request->log.lvl &= ~RAD_REQUEST_OPTION_PROXY_EAP;
-                       eap_ds->request->code = PW_EAP_FAILURE;
-                       return 1;
+                       RDEBUG2("built change password packet");
+                       debug_pair_list(request->packet->vps);
 
-               case PW_EAP_MSCHAPV2_SUCCESS:
                        /*
-                        * we sent a success to the client; some clients send a
-                        * success back as-per the RFC, some send an ACK. Permit
-                        * both, I guess...
+                        * jump to "authentication"
                         */
+                       goto packet_ready;
+               }
+
+               /*
+                * we sent a failure and are expecting a failure back
+                */
+               if (ccode != PW_EAP_MSCHAPV2_FAILURE) {
+                       REDEBUG("Sent FAILURE expecting FAILURE but got %d", ccode);
+                       return 0;
+               }
 
-                       switch (ccode) {
-                               case PW_EAP_MSCHAPV2_SUCCESS:
-                                       eap_ds->request->code = PW_EAP_SUCCESS;
+failure:
+               request->log.lvl &= ~RAD_REQUEST_OPTION_PROXY_EAP;
+               eap_ds->request->code = PW_EAP_FAILURE;
+               return 1;
 
-                                       pairfilter(request->reply,
-                                                 &request->reply->vps,
-                                                 &data->mppe_keys, 0, 0, TAG_ANY);
-                                       /* fall through... */
+       case PW_EAP_MSCHAPV2_SUCCESS:
+               /*
+                * we sent a success to the client; some clients send a
+                * success back as-per the RFC, some send an ACK. Permit
+                * both, I guess...
+                */
 
-                               case PW_EAP_MSCHAPV2_ACK:
-#ifdef WITH_PROXY
-                                       /*
-                                        *      It's a success.  Don't proxy it.
-                                        */
-                                       request->log.lvl &= ~RAD_REQUEST_OPTION_PROXY_EAP;
-#endif
-                                       pairfilter(request->reply,
-                                                 &request->reply->vps,
-                                                 &data->reply, 0, 0, TAG_ANY);
-                                       return 1;
-                       }
-                       REDEBUG("Sent SUCCESS expecting SUCCESS (or ACK) but got %d", ccode);
-                       return 0;
+               switch (ccode) {
+               case PW_EAP_MSCHAPV2_SUCCESS:
+                       eap_ds->request->code = PW_EAP_SUCCESS;
 
-               case PW_EAP_MSCHAPV2_CHALLENGE:
-                       if (ccode == PW_EAP_MSCHAPV2_FAILURE) goto failure;
+                       pairfilter(request->reply,
+                                 &request->reply->vps,
+                                 &data->mppe_keys, 0, 0, TAG_ANY);
+                       /* FALL-THROUGH */
 
+               case PW_EAP_MSCHAPV2_ACK:
+#ifdef WITH_PROXY
                        /*
-                        * we sent a challenge, expecting a response
+                        *      It's a success.  Don't proxy it.
                         */
-                       if (ccode != PW_EAP_MSCHAPV2_RESPONSE) {
-                               REDEBUG("Sent CHALLENGE expecting RESPONSE but got %d", ccode);
-                               return 0;
-                       }
-                       /* authentication happens below */
-                       break;
+                       request->log.lvl &= ~RAD_REQUEST_OPTION_PROXY_EAP;
+#endif
+                       pairfilter(request->reply,
+                                 &request->reply->vps,
+                                 &data->reply, 0, 0, TAG_ANY);
+                       return 1;
+               }
+               REDEBUG("Sent SUCCESS expecting SUCCESS (or ACK) but got %d", ccode);
+               return 0;
 
+       case PW_EAP_MSCHAPV2_CHALLENGE:
+               if (ccode == PW_EAP_MSCHAPV2_FAILURE) goto failure;
 
-               default:
-                       /* should never happen */
-                       REDEBUG("unknown state %d", data->code);
+               /*
+                * we sent a challenge, expecting a response
+                */
+               if (ccode != PW_EAP_MSCHAPV2_RESPONSE) {
+                       REDEBUG("Sent CHALLENGE expecting RESPONSE but got %d", ccode);
                        return 0;
+               }
+               /* authentication happens below */
+               break;
+
+       default:
+               /* should never happen */
+               REDEBUG("unknown state %d", data->code);
+               return 0;
        }
 
 
index c603f62..5228cf9 100644 (file)
@@ -230,7 +230,6 @@ static int eapmessage_verify(REQUEST *request,
                RDEBUG2("Identity - %*s",
                       data_len - 1, data + 1);
                return 1;
-               break;
 
                /*
                 *      If the first byte of the packet is
@@ -683,22 +682,29 @@ static int CC_HINT(nonnull) eappeap_postproxy(eap_handler_t *handler, void *data
 static char const *peap_state(peap_tunnel_t *t)
 {
        switch (t->status) {
-               case PEAP_STATUS_TUNNEL_ESTABLISHED:
-                       return "TUNNEL ESTABLISHED";
-               case PEAP_STATUS_WAIT_FOR_SOH_RESPONSE:
-                       return "WAITING FOR SOH RESPONSE";
-               case PEAP_STATUS_INNER_IDENTITY_REQ_SENT:
-                       return "WAITING FOR INNER IDENTITY";
-               case PEAP_STATUS_SENT_TLV_SUCCESS:
-                       return "send tlv success";
-               case PEAP_STATUS_SENT_TLV_FAILURE:
-                       return "send tlv failure";
-               case PEAP_STATUS_PHASE2_INIT:
-                       return "phase2_init";
-               case PEAP_STATUS_PHASE2:
-                       return "phase2";
-               default:
-                       break;
+       case PEAP_STATUS_TUNNEL_ESTABLISHED:
+               return "TUNNEL ESTABLISHED";
+
+       case PEAP_STATUS_WAIT_FOR_SOH_RESPONSE:
+               return "WAITING FOR SOH RESPONSE";
+
+       case PEAP_STATUS_INNER_IDENTITY_REQ_SENT:
+               return "WAITING FOR INNER IDENTITY";
+
+       case PEAP_STATUS_SENT_TLV_SUCCESS:
+               return "send tlv success";
+
+       case PEAP_STATUS_SENT_TLV_FAILURE:
+               return "send tlv failure";
+
+       case PEAP_STATUS_PHASE2_INIT:
+               return "phase2_init";
+
+       case PEAP_STATUS_PHASE2:
+               return "phase2";
+
+       default:
+               break;
        }
        return "?";
 }
index 9760068..441ca4f 100644 (file)
@@ -143,28 +143,28 @@ static int eap_sim_get_challenge(eap_handler_t *handler, VALUE_PAIR *vps, int id
                }
 
                switch (algo_version->vp_integer) {
-                       case 1:
-                               comp128v1(ess->keys.sres[idx], ess->keys.Kc[idx], ki->vp_octets, ess->keys.rand[idx]);
-                               break;
-
-                       case 2:
-                               comp128v23(ess->keys.sres[idx], ess->keys.Kc[idx], ki->vp_octets, ess->keys.rand[idx],
-                                          true);
-                               break;
-
-                       case 3:
-                               comp128v23(ess->keys.sres[idx], ess->keys.Kc[idx], ki->vp_octets, ess->keys.rand[idx],
-                                          false);
-                               break;
-
-                       case 4:
-                               REDEBUG("Comp128-4 algorithm is not supported as details have not yet been published. "
-                                       "If you have details of this algorithm please contact the FreeRADIUS "
-                                       "maintainers");
-                               return 0;
-
-                       default:
-                               REDEBUG("Unknown/unsupported algorithm Comp128-%i", algo_version->vp_integer);
+               case 1:
+                       comp128v1(ess->keys.sres[idx], ess->keys.Kc[idx], ki->vp_octets, ess->keys.rand[idx]);
+                       break;
+
+               case 2:
+                       comp128v23(ess->keys.sres[idx], ess->keys.Kc[idx], ki->vp_octets, ess->keys.rand[idx],
+                                  true);
+                       break;
+
+               case 3:
+                       comp128v23(ess->keys.sres[idx], ess->keys.Kc[idx], ki->vp_octets, ess->keys.rand[idx],
+                                  false);
+                       break;
+
+               case 4:
+                       REDEBUG("Comp128-4 algorithm is not supported as details have not yet been published. "
+                               "If you have details of this algorithm please contact the FreeRADIUS "
+                               "maintainers");
+                       return 0;
+
+               default:
+                       REDEBUG("Unknown/unsupported algorithm Comp128-%i", algo_version->vp_integer);
                }
 
                if (RDEBUG_ENABLED2) {
index b36a251..acb02c0 100644 (file)
@@ -301,12 +301,11 @@ static int mod_authenticate(UNUSED void *instance, eap_handler_t *handler)
        switch (connection_state) {
        case TNC_CONNECTION_STATE_HANDSHAKE:
                code = PW_EAP_REQUEST;
-
                break;
+
        case TNC_CONNECTION_STATE_ACCESS_NONE:
                code = PW_EAP_FAILURE;
                pairmake_config("TNC-Status", "None", T_OP_SET);
-
                break;
 
        case TNC_CONNECTION_STATE_ACCESS_ALLOWED:
@@ -317,11 +316,10 @@ static int mod_authenticate(UNUSED void *instance, eap_handler_t *handler)
        case TNC_CONNECTION_STATE_ACCESS_ISOLATED:
                code = PW_EAP_SUCCESS;
                pairmake_config("TNC-Status", "Isolate", T_OP_SET);
-
                break;
+
        default:
                ERROR("rlm_eap_tnc: Invalid connection state");
-
                return 0;
        }
 
index 0141173..c9fec78 100644 (file)
@@ -231,13 +231,13 @@ static int mod_authenticate(void *arg, eap_handler_t *handler)
        status = eaptls_process(handler);
        RDEBUG2("eaptls_process returned %d\n", status);
        switch (status) {
-               /*
-                *      EAP-TLS handshake was successful, tell the
-                *      client to keep talking.
-                *
-                *      If this was EAP-TLS, we would just return
-                *      an EAP-TLS-Success packet here.
-                */
+       /*
+        *      EAP-TLS handshake was successful, tell the
+        *      client to keep talking.
+        *
+        *      If this was EAP-TLS, we would just return
+        *      an EAP-TLS-Success packet here.
+        */
        case FR_TLS_SUCCESS:
                if (SSL_session_reused(tls_session->ssl)) {
                        RDEBUG("Skipping Phase2 due to session resumption");
@@ -260,24 +260,24 @@ static int mod_authenticate(void *arg, eap_handler_t *handler)
                }
                return 1;
 
-               /*
-                *      The TLS code is still working on the TLS
-                *      exchange, and it's a valid TLS request.
-                *      do nothing.
-                */
+       /*
+        *      The TLS code is still working on the TLS
+        *      exchange, and it's a valid TLS request.
+        *      do nothing.
+        */
        case FR_TLS_HANDLED:
                return 1;
 
-               /*
-                *      Handshake is done, proceed with decoding tunneled
-                *      data.
-                */
+       /*
+        *      Handshake is done, proceed with decoding tunneled
+        *      data.
+        */
        case FR_TLS_OK:
                break;
 
-               /*
-                *      Anything else: fail.
-                */
+       /*
+        *      Anything else: fail.
+        */
        default:
                return 0;
        }
index a4d3a57..3bb4aaa 100644 (file)
@@ -1134,11 +1134,11 @@ int eapttls_process(eap_handler_t *handler, tls_session_t *tls_session)
                         *      Some attributes are handled specially.
                         */
                        switch (vp->da->attr) {
-                               /*
-                                *      NEVER copy Message-Authenticator,
-                                *      EAP-Message, or State.  They're
-                                *      only for outside of the tunnel.
-                                */
+                       /*
+                        *      NEVER copy Message-Authenticator,
+                        *      EAP-Message, or State.  They're
+                        *      only for outside of the tunnel.
+                        */
                        case PW_USER_NAME:
                        case PW_USER_PASSWORD:
                        case PW_CHAP_PASSWORD:
@@ -1148,11 +1148,10 @@ int eapttls_process(eap_handler_t *handler, tls_session_t *tls_session)
                        case PW_EAP_MESSAGE:
                        case PW_STATE:
                                continue;
-                               break;
 
-                               /*
-                                *      By default, copy it over.
-                                */
+                       /*
+                        *      By default, copy it over.
+                        */
                        default:
                                break;
                        }
index 173f768..59f4006 100644 (file)
@@ -407,13 +407,14 @@ static rlm_rcode_t CC_HINT(nonnull) mod_post_auth(void *instance, REQUEST *reque
 
        finish:
        switch (rcode) {
-               case RLM_MODULE_FAIL:
-               case RLM_MODULE_INVALID:
-               case RLM_MODULE_REJECT:
-                       request->reply->code = PW_CODE_ACCESS_REJECT;
-                       break;
-               default:
-                       break;
+       case RLM_MODULE_FAIL:
+       case RLM_MODULE_INVALID:
+       case RLM_MODULE_REJECT:
+               request->reply->code = PW_CODE_ACCESS_REJECT;
+               break;
+
+       default:
+               break;
        }
 
        return rcode;
index 85cd906..eec5aa3 100644 (file)
@@ -81,21 +81,21 @@ static int presufcmp(UNUSED void *instance,
 
        len = strlen(check->vp_strvalue);
        if (check->da->vendor == 0) switch (check->da->attr) {
-               case PW_PREFIX:
-                       ret = strncmp(name, check->vp_strvalue, len);
-                       if (ret == 0)
-                               strlcpy(rest, name + len, sizeof(rest));
-                       break;
-               case PW_SUFFIX:
-                       namelen = strlen(name);
-                       if (namelen < len)
-                               break;
-                       ret = strcmp(name + namelen - len,
-                                    check->vp_strvalue);
-                       if (ret == 0) {
-                               strlcpy(rest, name, namelen - len + 1);
-                       }
+       case PW_PREFIX:
+               ret = strncmp(name, check->vp_strvalue, len);
+               if (ret == 0)
+                       strlcpy(rest, name + len, sizeof(rest));
+               break;
+       case PW_SUFFIX:
+               namelen = strlen(name);
+               if (namelen < len)
                        break;
+               ret = strcmp(name + namelen - len,
+                            check->vp_strvalue);
+               if (ret == 0) {
+                       strlcpy(rest, name, namelen - len + 1);
+               }
+               break;
        }
        if (ret != 0) {
                return ret;
index 1e2d4c4..c380403 100644 (file)
@@ -465,6 +465,7 @@ static ssize_t urlquote_xlat(UNUSED void *instance, UNUSED REQUEST *request,
                case '~':
                        *out++ = *p++;
                        break;
+
                default:
                        if (freespace < 3)
                                break;
index 6630ee8..a1aa172 100644 (file)
@@ -591,14 +591,36 @@ int main(int argc, char **argv) {
 
        while ((ch = getopt(argc, argv, "acrvnou"))!= -1)
        switch (ch) {
-       case 'a': aflag++;break;
-       case 'c': cflag++;break;
-       case 'r': rflag++;break;
-       case 'v': vflag = 1;break;
-       case 'n': nflag = 1;break;
-       case 'o': oflag = 1;break;
-       case 'u': uflag = 1;break;
-       default: usage(argv0);
+       case 'a':
+               aflag++;
+               break;
+
+       case 'c':
+               cflag++;
+               break;
+
+       case 'r':
+               rflag++;
+               break;
+
+       case 'v':
+               vflag = 1;
+               break;
+
+       case 'n':
+               nflag = 1;
+               break;
+
+       case 'o':
+               oflag = 1;
+               break;
+
+       case 'u':
+               uflag = 1;
+               break;
+
+       default:
+               usage(argv0);
        }
        argc -= optind;
        argv += optind;
index af83c50..a1ac219 100644 (file)
@@ -454,13 +454,15 @@ rlm_rcode_t rlm_ldap_map_profile(ldap_instance_t const *inst, REQUEST *request,
 
        status = rlm_ldap_search(inst, request, pconn, dn, LDAP_SCOPE_BASE, filter, expanded->attrs, &result);
        switch (status) {
-               case LDAP_PROC_SUCCESS:
-                       break;
-               case LDAP_PROC_NO_RESULT:
-                       RDEBUG("Profile object \"%s\" not found", dn);
-                       return RLM_MODULE_NOTFOUND;
-               default:
-                       return RLM_MODULE_FAIL;
+       case LDAP_PROC_SUCCESS:
+               break;
+
+       case LDAP_PROC_NO_RESULT:
+               RDEBUG("Profile object \"%s\" not found", dn);
+               return RLM_MODULE_NOTFOUND;
+
+       default:
+               return RLM_MODULE_FAIL;
        }
 
        rad_assert(*pconn);
index 87931ee..b4455c5 100644 (file)
@@ -117,13 +117,15 @@ int rlm_ldap_load_clients(ldap_instance_t const *inst)
        status = rlm_ldap_search(inst, NULL, &conn, inst->clientobj_base_dn, inst->clientobj_scope,
                                 inst->clientobj_filter, attrs, &result);
        switch (status) {
-               case LDAP_PROC_SUCCESS:
-                       break;
-               case LDAP_PROC_NO_RESULT:
-                       LDAP_INFO("No clients were found in the directory");
-                       return 0;
-               default:
-                       return -1;
+       case LDAP_PROC_SUCCESS:
+               break;
+
+       case LDAP_PROC_NO_RESULT:
+               LDAP_INFO("No clients were found in the directory");
+               return 0;
+
+       default:
+               return -1;
        }
 
        rad_assert(conn);
index 458c9eb..fba515f 100644 (file)
@@ -94,14 +94,16 @@ static rlm_rcode_t rlm_ldap_group_name2dn(ldap_instance_t const *inst, REQUEST *
        status = rlm_ldap_search(inst, request, pconn, inst->groupobj_base_dn, inst->groupobj_scope,
                                 filter, attrs, &result);
        switch (status) {
-               case LDAP_PROC_SUCCESS:
-                       break;
-               case LDAP_PROC_NO_RESULT:
-                       RDEBUG("Tried to resolve group name(s) to DNs but got no results");
-                       goto finish;
-               default:
-                       rcode = RLM_MODULE_FAIL;
-                       goto finish;
+       case LDAP_PROC_SUCCESS:
+               break;
+
+       case LDAP_PROC_NO_RESULT:
+               RDEBUG("Tried to resolve group name(s) to DNs but got no results");
+               goto finish;
+
+       default:
+               rcode = RLM_MODULE_FAIL;
+               goto finish;
        }
 
        entry_cnt = ldap_count_entries((*pconn)->handle, result);
@@ -195,14 +197,15 @@ static rlm_rcode_t rlm_ldap_group_dn2name(ldap_instance_t const *inst, REQUEST *
        status = rlm_ldap_search(inst, request, pconn, dn, LDAP_SCOPE_BASE, NULL, attrs,
                                 &result);
        switch (status) {
-               case LDAP_PROC_SUCCESS:
-                       break;
-               case LDAP_PROC_NO_RESULT:
-                       REDEBUG("DN \"%s\" did not resolve to an object", dn);
+       case LDAP_PROC_SUCCESS:
+               break;
 
-                       return RLM_MODULE_INVALID;
-               default:
-                       return RLM_MODULE_FAIL;
+       case LDAP_PROC_NO_RESULT:
+               REDEBUG("DN \"%s\" did not resolve to an object", dn);
+               return RLM_MODULE_INVALID;
+
+       default:
+               return RLM_MODULE_FAIL;
        }
 
        entry = ldap_first_entry((*pconn)->handle, result);
@@ -395,12 +398,14 @@ rlm_rcode_t rlm_ldap_cacheable_groupobj(ldap_instance_t const *inst, REQUEST *re
 
        status = rlm_ldap_search(inst, request, pconn, base_dn, inst->groupobj_scope, filter, attrs, &result);
        switch (status) {
-               case LDAP_PROC_SUCCESS:
-                       break;
-               case LDAP_PROC_NO_RESULT:
-                       RDEBUG2("No cacheable group memberships found in group objects");
-               default:
-                       goto finish;
+       case LDAP_PROC_SUCCESS:
+               break;
+
+       case LDAP_PROC_NO_RESULT:
+               RDEBUG2("No cacheable group memberships found in group objects");
+
+       default:
+               goto finish;
        }
 
        entry = ldap_first_entry((*pconn)->handle, result);
@@ -521,12 +526,10 @@ rlm_rcode_t rlm_ldap_check_groupobj_dynamic(ldap_instance_t const *inst, REQUEST
        switch (status) {
        case LDAP_PROC_SUCCESS:
                RDEBUG("User found in group object");
-
                break;
 
        case LDAP_PROC_NO_RESULT:
                RDEBUG("Search returned not found");
-
                return RLM_MODULE_NOTFOUND;
 
        default:
index bb412f3..5da3291 100644 (file)
@@ -349,7 +349,6 @@ process_error:
        switch (lib_errno) {
        case LDAP_SUCCESS:
                *error = "Success";
-
                break;
 
        case LDAP_NO_SUCH_OBJECT:
@@ -810,27 +809,27 @@ ldap_rcode_t rlm_ldap_modify(ldap_instance_t const *inst, REQUEST *request, ldap
                RDEBUG2("Waiting for modify result...");
                status = rlm_ldap_result(inst, *pconn, msgid, dn, NULL, &error, &extra);
                switch (status) {
-                       case LDAP_PROC_SUCCESS:
-                               break;
+               case LDAP_PROC_SUCCESS:
+                       break;
 
-                       case LDAP_PROC_RETRY:
-                               *pconn = fr_connection_reconnect(inst->pool, *pconn);
-                               if (*pconn) {
-                                       RWDEBUG("Modify failed: %s. Got new socket, retrying...", error);
+               case LDAP_PROC_RETRY:
+                       *pconn = fr_connection_reconnect(inst->pool, *pconn);
+                       if (*pconn) {
+                               RWDEBUG("Modify failed: %s. Got new socket, retrying...", error);
 
-                                       talloc_free(extra); /* don't leak debug info */
+                               talloc_free(extra); /* don't leak debug info */
 
-                                       continue;
-                               }
+                               continue;
+                       }
 
-                               status = LDAP_PROC_ERROR;
+                       status = LDAP_PROC_ERROR;
 
-                               /* FALL-THROUGH */
-                       default:
-                               REDEBUG("Failed modifying object: %s", error);
-                               REDEBUG("%s", extra);
+                       /* FALL-THROUGH */
+               default:
+                       REDEBUG("Failed modifying object: %s", error);
+                       REDEBUG("%s", extra);
 
-                               goto finish;
+                       goto finish;
                }
 
                break;
@@ -935,16 +934,16 @@ char const *rlm_ldap_find_user(ldap_instance_t const *inst, REQUEST *request, ld
 
        status = rlm_ldap_search(inst, request, pconn, base_dn, inst->userobj_scope, filter, attrs, result);
        switch (status) {
-               case LDAP_PROC_SUCCESS:
-                       break;
+       case LDAP_PROC_SUCCESS:
+               break;
 
-               case LDAP_PROC_NO_RESULT:
-                       *rcode = RLM_MODULE_NOTFOUND;
-                       return NULL;
+       case LDAP_PROC_NO_RESULT:
+               *rcode = RLM_MODULE_NOTFOUND;
+               return NULL;
 
-               default:
-                       *rcode = RLM_MODULE_FAIL;
-                       return NULL;
+       default:
+               *rcode = RLM_MODULE_FAIL;
+               return NULL;
        }
 
        rad_assert(*pconn);
index 5932687..b401fd7 100644 (file)
@@ -311,12 +311,14 @@ static ssize_t ldap_xlat(void *instance, REQUEST *request, char const *fmt, char
        status = rlm_ldap_search(inst, request, &conn, ldap_url->lud_dn, ldap_url->lud_scope, ldap_url->lud_filter,
                                 attrs, &result);
        switch (status) {
-               case LDAP_PROC_SUCCESS:
-                       break;
-               case LDAP_PROC_NO_RESULT:
-                       RDEBUG("Search returned not found");
-               default:
-                       goto free_socket;
+       case LDAP_PROC_SUCCESS:
+               break;
+
+       case LDAP_PROC_NO_RESULT:
+               RDEBUG("Search returned not found");
+
+       default:
+               goto free_socket;
        }
 
        rad_assert(conn);
@@ -394,20 +396,20 @@ static int rlm_ldap_groupcmp(void *instance, REQUEST *request, UNUSED VALUE_PAIR
        check_is_dn = rlm_ldap_is_dn(check->vp_strvalue);
        if ((check_is_dn && inst->cacheable_group_dn) || (!check_is_dn && inst->cacheable_group_name)) {
                switch (rlm_ldap_check_cached(inst, request, check)) {
-                       case RLM_MODULE_NOTFOUND:
-                               found = false;
-                               goto finish;
+               case RLM_MODULE_NOTFOUND:
+                       found = false;
+                       goto finish;
 
-                       case RLM_MODULE_OK:
-                               found = true;
-                               goto finish;
-                       /*
-                        *      Fallback to dynamic search on failure
-                        */
-                       case RLM_MODULE_FAIL:
-                       case RLM_MODULE_INVALID:
-                       default:
-                               break;
+               case RLM_MODULE_OK:
+                       found = true;
+                       goto finish;
+               /*
+                *      Fallback to dynamic search on failure
+                */
+               case RLM_MODULE_FAIL:
+               case RLM_MODULE_INVALID:
+               default:
+                       break;
                }
        }
 
@@ -430,14 +432,14 @@ static int rlm_ldap_groupcmp(void *instance, REQUEST *request, UNUSED VALUE_PAIR
         */
        if (inst->groupobj_membership_filter) {
                switch (rlm_ldap_check_groupobj_dynamic(inst, request, &conn, check)) {
-                       case RLM_MODULE_NOTFOUND:
-                               break;
+               case RLM_MODULE_NOTFOUND:
+                       break;
 
-                       case RLM_MODULE_OK:
-                               found = true;
+               case RLM_MODULE_OK:
+                       found = true;
 
-                       default:
-                               goto finish;
+               default:
+                       goto finish;
                }
        }
 
@@ -448,14 +450,14 @@ static int rlm_ldap_groupcmp(void *instance, REQUEST *request, UNUSED VALUE_PAIR
         */
        if (inst->userobj_membership_attr) {
                switch (rlm_ldap_check_userobj_dynamic(inst, request, &conn, user_dn, check)) {
-                       case RLM_MODULE_NOTFOUND:
-                               break;
+               case RLM_MODULE_NOTFOUND:
+                       break;
 
-                       case RLM_MODULE_OK:
-                               found = true;
+               case RLM_MODULE_OK:
+                       found = true;
 
-                       default:
-                               goto finish;
+               default:
+                       goto finish;
                }
        }
 
index 5af6774..2b34820 100644 (file)
@@ -72,64 +72,64 @@ static int pdb_decode_acct_ctrl(char const *p)
 
        for (p++; *p && !done; p++) {
                switch (*p) {
-                       case 'N': /* 'N'o password. */
-                         acct_ctrl |= ACB_PWNOTREQ;
-                         break;
-
-                       case 'D':  /* 'D'isabled. */
-                         acct_ctrl |= ACB_DISABLED ;
-                         break;
-
-                       case 'H':  /* 'H'omedir required. */
-                         acct_ctrl |= ACB_HOMDIRREQ;
-                         break;
-
-                       case 'T': /* 'T'emp account. */
-                         acct_ctrl |= ACB_TEMPDUP;
-                         break;
-
-                       case 'U': /* 'U'ser account (normal). */
-                         acct_ctrl |= ACB_NORMAL;
-                         break;
-
-                       case 'M': /* 'M'NS logon user account. What is this? */
-                         acct_ctrl |= ACB_MNS;
-                         break;
-
-                       case 'W': /* 'W'orkstation account. */
-                         acct_ctrl |= ACB_WSTRUST;
-                         break;
-
-                       case 'S': /* 'S'erver account. */
-                         acct_ctrl |= ACB_SVRTRUST;
-                         break;
-
-                       case 'L': /* 'L'ocked account. */
-                         acct_ctrl |= ACB_AUTOLOCK;
-                         break;
-
-                       case 'X': /* No 'X'piry on password */
-                         acct_ctrl |= ACB_PWNOEXP;
-                         break;
-
-                       case 'I': /* 'I'nterdomain trust account. */
-                         acct_ctrl |= ACB_DOMTRUST;
-                         break;
-
-                       case 'e': /* 'e'xpired, the password has */
-                         acct_ctrl |= ACB_PW_EXPIRED;
-                         break;
-
-                       case ' ': /* ignore spaces */
-                         break;
-
-                       case ':':
-                       case '\n':
-                       case '\0':
-                       case ']':
-                       default:
-                         done = 1;
-                         break;
+               case 'N': /* 'N'o password. */
+                       acct_ctrl |= ACB_PWNOTREQ;
+                       break;
+
+               case 'D':  /* 'D'isabled. */
+                       acct_ctrl |= ACB_DISABLED ;
+                       break;
+
+               case 'H':  /* 'H'omedir required. */
+                       acct_ctrl |= ACB_HOMDIRREQ;
+                       break;
+
+               case 'T': /* 'T'emp account. */
+                       acct_ctrl |= ACB_TEMPDUP;
+                       break;
+
+               case 'U': /* 'U'ser account (normal). */
+                       acct_ctrl |= ACB_NORMAL;
+                       break;
+
+               case 'M': /* 'M'NS logon user account. What is this? */
+                       acct_ctrl |= ACB_MNS;
+                       break;
+
+               case 'W': /* 'W'orkstation account. */
+                       acct_ctrl |= ACB_WSTRUST;
+                       break;
+
+               case 'S': /* 'S'erver account. */
+                       acct_ctrl |= ACB_SVRTRUST;
+                       break;
+
+               case 'L': /* 'L'ocked account. */
+                       acct_ctrl |= ACB_AUTOLOCK;
+                       break;
+
+               case 'X': /* No 'X'piry on password */
+                       acct_ctrl |= ACB_PWNOEXP;
+                       break;
+
+               case 'I': /* 'I'nterdomain trust account. */
+                       acct_ctrl |= ACB_DOMTRUST;
+                       break;
+
+               case 'e': /* 'e'xpired, the password has */
+                       acct_ctrl |= ACB_PW_EXPIRED;
+                       break;
+
+               case ' ': /* ignore spaces */
+                       break;
+
+               case ':':
+               case '\n':
+               case '\0':
+               case ']':
+               default:
+                       done = 1;
+                       break;
                }
        }
 
index 20b7c50..54ec500 100644 (file)
@@ -195,7 +195,7 @@ int otp_pw_valid(REQUEST *request, int pwe, char const *challenge,
                (void) memcpy(otp_request.pwe.u.chap.response, rvp->vp_octets,
                              rvp->length);
                otp_request.pwe.u.chap.rlen = rvp->length;
-       break;
+               break;
        } /* switch (otp_request.pwe.pwe) */
 
        /*
index 81155d5..485b1fd 100644 (file)
@@ -71,53 +71,56 @@ static const CONF_PARSER module_config[] = {
  *************************************************************************/
 
 typedef struct my_PAM {
-  char const *username;
-  char const *password;
-  int   error;
+       char const *username;
+       char const *password;
+       int      error;
 } my_PAM;
 
 static int PAM_conv(int num_msg, struct pam_message const **msg, struct pam_response **resp, void *appdata_ptr) {
-  int count;
-  struct pam_response *reply;
-  my_PAM *pam_config = (my_PAM *) appdata_ptr;
+       int count;
+       struct pam_response *reply;
+       my_PAM *pam_config = (my_PAM *) appdata_ptr;
 
 /* strdup(NULL) doesn't work on some platforms */
 #define COPY_STRING(s) ((s) ? strdup(s) : NULL)
 
-  reply = rad_malloc(num_msg * sizeof(struct pam_response));
-  memset(reply, 0, num_msg * sizeof(struct pam_response));
-  for (count = 0; count < num_msg; count++) {
-    switch (msg[count]->msg_style) {
-    case PAM_PROMPT_ECHO_ON:
-      reply[count].resp_retcode = PAM_SUCCESS;
-      reply[count].resp = COPY_STRING(pam_config->username);
-      break;
-    case PAM_PROMPT_ECHO_OFF:
-      reply[count].resp_retcode = PAM_SUCCESS;
-      reply[count].resp = COPY_STRING(pam_config->password);
-      break;
-    case PAM_TEXT_INFO:
-      /* ignore it... */
-      break;
-    case PAM_ERROR_MSG:
-    default:
-      /* Must be an error of some sort... */
-      for (count = 0; count < num_msg; count++) {
-       if (reply[count].resp) {
-         /* could be a password, let's be sanitary */
-         memset(reply[count].resp, 0, strlen(reply[count].resp));
-         free(reply[count].resp);
+       reply = rad_malloc(num_msg * sizeof(struct pam_response));
+       memset(reply, 0, num_msg * sizeof(struct pam_response));
+       for (count = 0; count < num_msg; count++) {
+               switch (msg[count]->msg_style) {
+               case PAM_PROMPT_ECHO_ON:
+                       reply[count].resp_retcode = PAM_SUCCESS;
+                       reply[count].resp = COPY_STRING(pam_config->username);
+                       break;
+
+               case PAM_PROMPT_ECHO_OFF:
+                       reply[count].resp_retcode = PAM_SUCCESS;
+                       reply[count].resp = COPY_STRING(pam_config->password);
+                       break;
+
+               case PAM_TEXT_INFO:
+               /* ignore it... */
+                       break;
+
+               case PAM_ERROR_MSG:
+               default:
+                       /* Must be an error of some sort... */
+                       for (count = 0; count < num_msg; count++) {
+                               if (reply[count].resp) {
+                                       /* could be a password, let's be sanitary */
+                                       memset(reply[count].resp, 0, strlen(reply[count].resp));
+                                       free(reply[count].resp);
+                               }
+                       }
+                       free(reply);
+                       pam_config->error = 1;
+                       return PAM_CONV_ERR;
+               }
        }
-      }
-      free(reply);
-      pam_config->error = 1;
-      return PAM_CONV_ERR;
-    }
-  }
-  *resp = reply;
-  /* PAM frees reply (including reply[].resp) */
+       *resp = reply;
+       /* PAM frees reply (including reply[].resp) */
 
-  return PAM_SUCCESS;
+       return PAM_SUCCESS;
 }
 
 /*************************************************************************
index ca69179..c21a3eb 100644 (file)
@@ -924,7 +924,6 @@ static rlm_rcode_t CC_HINT(nonnull) mod_accounting(void *instance, REQUEST *requ
        }
 
        switch (acctstatustype) {
-
        case PW_STATUS_START:
 
                if (((rlm_perl_t *)instance)->func_start_accounting) {
@@ -946,10 +945,10 @@ static rlm_rcode_t CC_HINT(nonnull) mod_accounting(void *instance, REQUEST *requ
                                       ((rlm_perl_t *)instance)->func_accounting);
                }
                break;
+
        default:
                return do_perl(instance, request,
                               ((rlm_perl_t *)instance)->func_accounting);
-
        }
 }
 
index ba8d1d3..e7acde6 100644 (file)
@@ -225,51 +225,55 @@ static rlm_rcode_t CC_HINT(nonnull) mod_accounting(void *instance, REQUEST *requ
             vp;
             vp = fr_cursor_next(&cursor)) {
                if (!vp->da->vendor) switch (vp->da->attr) {
-                       case PW_LOGIN_IP_HOST:
-                       case PW_FRAMED_IP_ADDRESS:
-                               ut.framed_address = vp->vp_ipaddr;
-                               break;
-                       case PW_FRAMED_PROTOCOL:
-                               protocol = vp->vp_integer;
-                               break;
-                       case PW_NAS_IP_ADDRESS:
-                               ut.nas_address = vp->vp_ipaddr;
-                               break;
-                       case PW_NAS_PORT:
-                               ut.nas_port = vp->vp_integer;
-                               port_seen = true;
-                               break;
-                       case PW_ACCT_DELAY_TIME:
-                               ut.delay = vp->vp_integer;
-                               break;
-                       case PW_ACCT_SESSION_ID:
-                               /*
-                                *      If length > 8, only store the
-                                *      last 8 bytes.
-                                */
-                               off = vp->length - sizeof(ut.session_id);
-                               /*
-                                *      Ascend is br0ken - it adds a \0
-                                *      to the end of any string.
-                                *      Compensate.
-                                */
-                               if (vp->length > 0 &&
-                                   vp->vp_strvalue[vp->length - 1] == 0)
-                                       off--;
-                               if (off < 0) off = 0;
-                               memcpy(ut.session_id, vp->vp_strvalue + off,
-                                       sizeof(ut.session_id));
-                               break;
-                       case PW_NAS_PORT_TYPE:
-                               if (vp->vp_integer <= 4)
-                                       ut.porttype = porttypes[vp->vp_integer];
-                               break;
-                       case PW_CALLING_STATION_ID:
-                               if(inst->caller_id_ok)
-                                       strlcpy(ut.caller_id,
-                                               vp->vp_strvalue,
-                                               sizeof(ut.caller_id));
-                               break;
+               case PW_LOGIN_IP_HOST:
+               case PW_FRAMED_IP_ADDRESS:
+                       ut.framed_address = vp->vp_ipaddr;
+                       break;
+
+               case PW_FRAMED_PROTOCOL:
+                       protocol = vp->vp_integer;
+                       break;
+
+               case PW_NAS_IP_ADDRESS:
+                       ut.nas_address = vp->vp_ipaddr;
+                       break;
+
+               case PW_NAS_PORT:
+                       ut.nas_port = vp->vp_integer;
+                       port_seen = true;
+                       break;
+
+               case PW_ACCT_DELAY_TIME:
+                       ut.delay = vp->vp_integer;
+                       break;
+
+               case PW_ACCT_SESSION_ID:
+                       /*
+                        *      If length > 8, only store the
+                        *      last 8 bytes.
+                        */
+                       off = vp->length - sizeof(ut.session_id);
+                       /*
+                        *      Ascend is br0ken - it adds a \0
+                        *      to the end of any string.
+                        *      Compensate.
+                        */
+                       if (vp->length > 0 &&
+                           vp->vp_strvalue[vp->length - 1] == 0)
+                               off--;
+                       if (off < 0) off = 0;
+                       memcpy(ut.session_id, vp->vp_strvalue + off,
+                               sizeof(ut.session_id));
+                       break;
+
+               case PW_NAS_PORT_TYPE:
+                       if (vp->vp_integer <= 4)
+                               ut.porttype = porttypes[vp->vp_integer];
+                       break;
+
+               case PW_CALLING_STATION_ID:
+                       if (inst->caller_id_ok) strlcpy(ut.caller_id, vp->vp_strvalue, sizeof(ut.caller_id));
+                       break;
                }
        }
 
index a476599..87e00d4 100644 (file)
@@ -87,11 +87,13 @@ static int rediswho_command(char const *fmt, REDISSOCK **dissocket_p,
                if (dissocket->reply->integer > 0)
                        result = dissocket->reply->integer;
                break;
+
        case REDIS_REPLY_STATUS:
        case REDIS_REPLY_STRING:
                DEBUG("rediswho_command: query response %s\n",
                      dissocket->reply->str);
                break;
+
        default:
                break;
        }
index 0de7d7e..ddf9c31 100644 (file)
@@ -66,18 +66,21 @@ static ssize_t soh_xlat(UNUSED void *instance, REQUEST *request, char const *fmt
                                snprintf(out, outlen, "Windows unknown");
                        } else {
                                switch (vp[1]->vp_integer) {
-                                       case 7:
-                                               osname = "7";
-                                               break;
-                                       case 6:
-                                               osname = "Vista";
-                                               break;
-                                       case 5:
-                                               osname = "XP";
-                                               break;
-                                       default:
-                                               osname = "Other";
-                                               break;
+                               case 7:
+                                       osname = "7";
+                                       break;
+
+                               case 6:
+                                       osname = "Vista";
+                                       break;
+
+                               case 5:
+                                       osname = "XP";
+                                       break;
+
+                               default:
+                                       osname = "Other";
+                                       break;
                                }
                                snprintf(out, outlen, "Windows %s %d.%d.%d sp %d.%d", osname, vp[1]->vp_integer,
                                                vp[2] ? vp[2]->vp_integer : 0,
@@ -145,36 +148,37 @@ static rlm_rcode_t CC_HINT(nonnull) mod_post_auth(UNUSED void * instance, UNUSED
                        vopt = *data++;
                        vlen = *data++;
                        switch (vopt) {
-                               case 220:
-                                       if (vlen <= 1) {
-                                               uint8_t *p;
-
-                                               RDEBUG("SoH adding NAP marker to DHCP reply");
-                                               /* client probe; send "NAP" in the reply */
-                                               vp = paircreate(request->reply, 43, DHCP_MAGIC_VENDOR);
-                                               vp->length = 5;
-                                               vp->vp_octets = p = talloc_array(vp, uint8_t, vp->length);
-
-                                               p[0] = 220;
-                                               p[1] = 3;
-                                               p[4] = 'N';
-                                               p[3] = 'A';
-                                               p[2] = 'P';
-
-                                               pairadd(&request->reply->vps, vp);
-
-                                       } else {
-                                               RDEBUG("SoH decoding NAP from DHCP request");
-                                               /* SoH payload */
-                                               rcode = soh_verify(request, data, vlen);
-                                               if (rcode < 0) {
-                                                       return RLM_MODULE_FAIL;
-                                               }
+                       case 220:
+                               if (vlen <= 1) {
+                                       uint8_t *p;
+
+                                       RDEBUG("SoH adding NAP marker to DHCP reply");
+                                       /* client probe; send "NAP" in the reply */
+                                       vp = paircreate(request->reply, 43, DHCP_MAGIC_VENDOR);
+                                       vp->length = 5;
+                                       vp->vp_octets = p = talloc_array(vp, uint8_t, vp->length);
+
+                                       p[0] = 220;
+                                       p[1] = 3;
+                                       p[4] = 'N';
+                                       p[3] = 'A';
+                                       p[2] = 'P';
+
+                                       pairadd(&request->reply->vps, vp);
+
+                               } else {
+                                       RDEBUG("SoH decoding NAP from DHCP request");
+                                       /* SoH payload */
+                                       rcode = soh_verify(request, data, vlen);
+                                       if (rcode < 0) {
+                                               return RLM_MODULE_FAIL;
                                        }
-                                       break;
-                               default:
-                                       /* nothing to do */
-                                       break;
+                               }
+                               break;
+
+                       default:
+                               /* nothing to do */
+                               break;
                        }
                        data += vlen;
                }
index 51641a7..b217a78 100644 (file)
@@ -196,8 +196,8 @@ void fb_store_row(rlm_sql_firebird_conn_t *conn)
 
                        memmove(conn->row[i], var->sqldata, var->sqllen);
                        conn->row[i][var->sqllen] = 0;
-
                        break;
+
                case SQL_VARYING:
                        vary = (VARY*) var->sqldata;
                        if (conn->row_sizes[i] <= vary->vary_length) {
@@ -207,72 +207,74 @@ void fb_store_row(rlm_sql_firebird_conn_t *conn)
                        }
                        memmove(conn->row[i], vary->vary_string, vary->vary_length);
                        conn->row[i][vary->vary_length] = 0;
-
                        break;
 
                case SQL_FLOAT:
                        snprintf(conn->row[i], conn->row_sizes[i], "%15g",
                                 *(float ISC_FAR *) (var->sqldata));
                        break;
+
                case SQL_SHORT:
                case SQL_LONG:
                case SQL_INT64:
-                       {
-                               ISC_INT64 value = 0;
-                               short field_width = 0;
-                               short dscale = 0;
-                               char *p;
-                               p = conn->row[i];
-
-                               switch (dtype) {
-                               case SQL_SHORT:
-                                       value = (ISC_INT64) *(short *)var->sqldata;
-                                       field_width = 6;
-                                       break;
-                               case SQL_LONG:
-                                       value = (ISC_INT64) *(int *)var->sqldata;
-                                       field_width = 11;
-                                       break;
-                               case SQL_INT64:
-                                       value = (ISC_INT64) *(ISC_INT64 *)var->sqldata;
-                                       field_width = 21;
-                                       break;
+               {
+                       ISC_INT64 value = 0;
+                       short field_width = 0;
+                       short dscale = 0;
+                       char *p;
+                       p = conn->row[i];
+
+                       switch (dtype) {
+                       case SQL_SHORT:
+                               value = (ISC_INT64) *(short *)var->sqldata;
+                               field_width = 6;
+                               break;
+
+                       case SQL_LONG:
+                               value = (ISC_INT64) *(int *)var->sqldata;
+                               field_width = 11;
+                               break;
+
+                       case SQL_INT64:
+                               value = (ISC_INT64) *(ISC_INT64 *)var->sqldata;
+                               field_width = 21;
+                               break;
+                       }
+                       dscale = var->sqlscale;
+
+                       if (dscale < 0) {
+                               ISC_INT64 tens;
+                               short j;
+
+                               tens = 1;
+                               for (j = 0; j > dscale; j--) {
+                                       tens *= 10;
                                }
-                               dscale = var->sqlscale;
-
-                               if (dscale < 0) {
-                                       ISC_INT64 tens;
-                                       short j;
-
-                                       tens = 1;
-                                       for (j = 0; j > dscale; j--) {
-                                               tens *= 10;
-                                       }
-
-                                       if (value >= 0) {
-                                               sprintf(p, "%*lld.%0*lld",
-                                                       field_width - 1 + dscale,
-                                                       (ISC_INT64) value / tens,
-                                                       -dscale,
-                                                       (ISC_INT64) value % tens);
-                                       } else if ((value / tens) != 0) {
-                                               sprintf (p, "%*lld.%0*lld",
-                                                       field_width - 1 + dscale,
-                                                       (ISC_INT64) (value / tens),
-                                                       -dscale,
-                                                       (ISC_INT64) -(value % tens));
-                                       } else {
-                                               sprintf(p, "%*s.%0*lld", field_width - 1 + dscale,
-                                                       "-0", -dscale, (ISC_INT64) - (value % tens));
-                                       }
-                               } else if (dscale) {
-                                       sprintf(p, "%*lld%0*d", field_width,
-                                               (ISC_INT64) value, dscale, 0);
+
+                               if (value >= 0) {
+                                       sprintf(p, "%*lld.%0*lld",
+                                               field_width - 1 + dscale,
+                                               (ISC_INT64) value / tens,
+                                               -dscale,
+                                               (ISC_INT64) value % tens);
+                               } else if ((value / tens) != 0) {
+                                       sprintf (p, "%*lld.%0*lld",
+                                               field_width - 1 + dscale,
+                                               (ISC_INT64) (value / tens),
+                                               -dscale,
+                                               (ISC_INT64) -(value % tens));
                                } else {
-                                       sprintf(p, "%*lld", field_width,
-                                               (ISC_INT64) value);
+                                       sprintf(p, "%*s.%0*lld", field_width - 1 + dscale,
+                                               "-0", -dscale, (ISC_INT64) - (value % tens));
                                }
+                       } else if (dscale) {
+                               sprintf(p, "%*lld%0*d", field_width,
+                                       (ISC_INT64) value, dscale, 0);
+                       } else {
+                               sprintf(p, "%*lld", field_width,
+                                       (ISC_INT64) value);
                        }
+               }
                        break;
 
                case SQL_D_FLOAT:
@@ -317,7 +319,6 @@ void fb_store_row(rlm_sql_firebird_conn_t *conn)
                        snprintf(conn->row[i], conn->row_sizes[i], "%08" ISC_LONG_FMT "x:%08" ISC_LONG_FMT "x",
                                 bid.gds_quad_high, bid.gds_quad_low);
                        break;
-
                }
        }
 }
@@ -490,6 +491,7 @@ int fb_sql_query(rlm_sql_firebird_conn_t *conn, char const *query) {
                        isc_dsql_execute2(conn->status, &conn->trh, &conn->stmt,
                                          SQL_DIALECT_V6, 0, conn->sqlda_out);
                        break;
+
                default:
                        isc_dsql_execute(conn->status, &conn->trh, &conn->stmt,
                                         SQL_DIALECT_V6, 0);
index 5059fdb..9abc9e1 100644 (file)
@@ -1012,27 +1012,27 @@ skipreply:
                RDEBUG3("... falling-through to group processing");
                ret = rlm_sql_process_groups(inst, request, &handle, &do_fall_through);
                switch (ret) {
-                       /*
-                        *      Nothing bad happened, continue...
-                        */
-                       case RLM_MODULE_UPDATED:
-                               rcode = RLM_MODULE_UPDATED;
-                               /* FALL-THROUGH */
-                       case RLM_MODULE_OK:
-                               if (rcode != RLM_MODULE_UPDATED) {
-                                       rcode = RLM_MODULE_OK;
-                               }
-                               /* FALL-THROUGH */
-                       case RLM_MODULE_NOOP:
-                               user_found = true;
-                               break;
+               /*
+                *      Nothing bad happened, continue...
+                */
+               case RLM_MODULE_UPDATED:
+                       rcode = RLM_MODULE_UPDATED;
+                       /* FALL-THROUGH */
+               case RLM_MODULE_OK:
+                       if (rcode != RLM_MODULE_UPDATED) {
+                               rcode = RLM_MODULE_OK;
+                       }
+                       /* FALL-THROUGH */
+               case RLM_MODULE_NOOP:
+                       user_found = true;
+                       break;
 
-                       case RLM_MODULE_NOTFOUND:
-                               break;
+               case RLM_MODULE_NOTFOUND:
+                       break;
 
-                       default:
-                               rcode = ret;
-                               goto release;
+               default:
+                       rcode = ret;
+                       goto release;
                }
        }
 
@@ -1067,27 +1067,27 @@ skipreply:
 
                ret = rlm_sql_process_groups(inst, request, &handle, &do_fall_through);
                switch (ret) {
-                       /*
-                        *      Nothing bad happened, continue...
-                        */
-                       case RLM_MODULE_UPDATED:
-                               rcode = RLM_MODULE_UPDATED;
-                               /* FALL-THROUGH */
-                       case RLM_MODULE_OK:
-                               if (rcode != RLM_MODULE_UPDATED) {
-                                       rcode = RLM_MODULE_OK;
-                               }
-                               /* FALL-THROUGH */
-                       case RLM_MODULE_NOOP:
-                               user_found = true;
-                               break;
+               /*
+                *      Nothing bad happened, continue...
+                */
+               case RLM_MODULE_UPDATED:
+                       rcode = RLM_MODULE_UPDATED;
+                       /* FALL-THROUGH */
+               case RLM_MODULE_OK:
+                       if (rcode != RLM_MODULE_UPDATED) {
+                               rcode = RLM_MODULE_OK;
+                       }
+                       /* FALL-THROUGH */
+               case RLM_MODULE_NOOP:
+                       user_found = true;
+                       break;
 
-                       case RLM_MODULE_NOTFOUND:
-                               break;
+               case RLM_MODULE_NOTFOUND:
+                       break;
 
-                       default:
-                               rcode = ret;
-                               goto release;
+               default:
+                       rcode = ret;
+                       goto release;
                }
        }
 
index e70e318..2063591 100644 (file)
@@ -437,14 +437,15 @@ static rlm_rcode_t CC_HINT(nonnull) mod_post_auth(void *instance, REQUEST *reque
                        "ORDER BY (`gid_ip`.`ip_stop` - `gid_ip`.`ip_start`) ASC "
                        "LIMIT %lu, 1",
                       inst->db_name, nasip, s_gid)) {
-                       case -1:
-                               nvp_log(__LINE__, inst, L_ERR,
-                                       "mod_post_auth(): couldn't find "
-                                       "any more matching host groups");
-                               goto end_gid;             /* exit the main loop */
-                       case 0:
-                               sql_release_socket(inst->sqlinst, sqlsock);
-                               return RLM_MODULE_FAIL;
+               case -1:
+                       nvp_log(__LINE__, inst, L_ERR,
+                               "mod_post_auth(): couldn't find "
+                               "any more matching host groups");
+                       goto end_gid;             /* exit the main loop */
+
+               case 0:
+                       sql_release_socket(inst->sqlinst, sqlsock);
+                       return RLM_MODULE_FAIL;
                }
 
                /* store the group ID and free memory occupied by results */
@@ -478,15 +479,16 @@ static rlm_rcode_t CC_HINT(nonnull) mod_post_auth(void *instance, REQUEST *reque
                                        "ORDER BY `prio` ASC "
                                        "LIMIT %lu, 1",
                                inst->db_name, gid, pname, s_prio)) {
-                               case -1:
-                                       nvp_log(__LINE__, inst, L_DBG,
-                                               "mod_post_auth(): couldn't find "
-                                               "any more matching pools for gid = %lu",
-                                               gid);
-                                       goto end_prio;         /* select next gid */
-                               case 0:
-                                       sql_release_socket(inst->sqlinst, sqlsock);
-                                       return RLM_MODULE_FAIL;
+                       case -1:
+                               nvp_log(__LINE__, inst, L_DBG,
+                                       "mod_post_auth(): couldn't find "
+                                       "any more matching pools for gid = %lu",
+                                       gid);
+                               goto end_prio;         /* select next gid */
+
+                       case 0:
+                               sql_release_socket(inst->sqlinst, sqlsock);
+                               return RLM_MODULE_FAIL;
                        }
 
                        /* store the prio and weights sum */
@@ -524,15 +526,16 @@ static rlm_rcode_t CC_HINT(nonnull) mod_post_auth(void *instance, REQUEST *reque
                                                "LIMIT %lu, 1",
                                        inst->db_name, gid, pname, prio,
                                        weights_sum, used_sum, s_pid)) {
-                                       case -1:
-                                               nvp_log(__LINE__, inst, L_DBG,
-                                                       "mod_post_auth(): couldn't find any more "
-                                                       "matching pools of prio = %ld for gid = %lu",
-                                                       prio, gid);
-                                               goto end_pid;         /* select next prio */
-                                       case 0:
-                                               sql_release_socket(inst->sqlinst, sqlsock);
-                                               return RLM_MODULE_FAIL;
+                               case -1:
+                                       nvp_log(__LINE__, inst, L_DBG,
+                                               "mod_post_auth(): couldn't find any more "
+                                               "matching pools of prio = %ld for gid = %lu",
+                                               prio, gid);
+                                       goto end_pid;         /* select next prio */
+
+                               case 0:
+                                       sql_release_socket(inst->sqlinst, sqlsock);
+                                       return RLM_MODULE_FAIL;
                                }
 
                                /* store the inst and free memory occupied by results */
@@ -573,15 +576,16 @@ static rlm_rcode_t CC_HINT(nonnull) mod_post_auth(void *instance, REQUEST *reque
                                                "ORDER BY `rsv_since` DESC "
                                                "LIMIT 1",
                                        inst->db_name, connid)) {
-                                       case -1:
-                                               nvp_log(__LINE__, inst, L_ERR,
-                                                       "mod_post_auth(): couldn't reserve an IP address "
-                                                       "from pool of pid = %lu (prio = %ld, gid = %lu)",
-                                                       pid, prio, gid);
-                                               continue;                           /* select next pid */
-                                       case 0:
-                                               sql_release_socket(inst->sqlinst, sqlsock);
-                                               return RLM_MODULE_FAIL;
+                               case -1:
+                                       nvp_log(__LINE__, inst, L_ERR,
+                                               "mod_post_auth(): couldn't reserve an IP address "
+                                               "from pool of pid = %lu (prio = %ld, gid = %lu)",
+                                               pid, prio, gid);
+                                       continue;                           /* select next pid */
+
+                               case 0:
+                                       sql_release_socket(inst->sqlinst, sqlsock);
+                                       return RLM_MODULE_FAIL;
                                }
 
                                /* update free IPs count */
@@ -689,71 +693,71 @@ static rlm_rcode_t CC_HINT(nonnull) mod_accounting(void *instance, REQUEST *requ
 
 
        switch (acct_type) {
-               case PW_STATUS_START:
-               case PW_STATUS_ALIVE:
-                       vp = pairfind(request->packet->vps, PW_FRAMED_IP_ADDRESS, 0, TAG_ANY);
-                       if (!vp) {
-                               nvp_log(__LINE__, inst, L_ERR, "mod_accounting(): no framed IP");
-                               sql_release_socket(inst->sqlinst, sqlsock);
-                               return RLM_MODULE_FAIL;
-                       }
+       case PW_STATUS_START:
+       case PW_STATUS_ALIVE:
+               vp = pairfind(request->packet->vps, PW_FRAMED_IP_ADDRESS, 0, TAG_ANY);
+               if (!vp) {
+                       nvp_log(__LINE__, inst, L_ERR, "mod_accounting(): no framed IP");
+                       sql_release_socket(inst->sqlinst, sqlsock);
+                       return RLM_MODULE_FAIL;
+               }
 
-                       framedip = ntohl(vp->vp_ipaddr);
+               framedip = ntohl(vp->vp_ipaddr);
 
-                       if (!nvp_query(__LINE__, inst, sqlsock,
-                           "UPDATE `%s`.`ips` "
-                               "SET "
-                                       "`rsv_until` = 0, "
-                                       "`rsv_by` = '%s' "
-                               "WHERE `ip` = %lu",
-                           inst->db_name, sessid, framedip)) {
-                               sql_release_socket(inst->sqlinst, sqlsock);
-                               return RLM_MODULE_FAIL;
-                       }
-                       nvp_finish(inst, sqlsock);
-                       break;
-
-               case PW_STATUS_STOP:
-                       if (!nvp_query(__LINE__, inst, sqlsock,
-                           "UPDATE `%s`.`ips`, `%1$s`.`ip_pools` "
-                               "SET "
-                                       "`ips`.`rsv_until` = NOW() + INTERVAL %u SECOND, "
-                                       "`ip_pools`.`free` = `ip_pools`.`free` + 1 "
-                               "WHERE "
-                                       "`ips`.`rsv_by` = '%s' AND "
-                                       "`ips`.`ip` BETWEEN `ip_pools`.`ip_start` AND `ip_pools`.`ip_stop`",
-                           inst->db_name, inst->free_after, sessid)) {
-                               sql_release_socket(inst->sqlinst, sqlsock);
-                               return RLM_MODULE_FAIL;
-                       }
-                       nvp_finish(inst, sqlsock);
+               if (!nvp_query(__LINE__, inst, sqlsock,
+                   "UPDATE `%s`.`ips` "
+                       "SET "
+                               "`rsv_until` = 0, "
+                               "`rsv_by` = '%s' "
+                       "WHERE `ip` = %lu",
+                   inst->db_name, sessid, framedip)) {
+                       sql_release_socket(inst->sqlinst, sqlsock);
+                       return RLM_MODULE_FAIL;
+               }
+               nvp_finish(inst, sqlsock);
                break;
 
-               case PW_STATUS_ACCOUNTING_OFF:
-               case PW_STATUS_ACCOUNTING_ON:
-                       vp = pairfind(request->packet->vps, PW_NAS_IP_ADDRESS, 0, TAG_ANY);
-                       if (!vp) {
-                               nvp_log(__LINE__, inst, L_ERR, "mod_accounting(): no NAS IP");
-                               sql_release_socket(inst->sqlinst, sqlsock);
-                               return RLM_MODULE_FAIL;
-                       }
+       case PW_STATUS_STOP:
+               if (!nvp_query(__LINE__, inst, sqlsock,
+                   "UPDATE `%s`.`ips`, `%1$s`.`ip_pools` "
+                       "SET "
+                               "`ips`.`rsv_until` = NOW() + INTERVAL %u SECOND, "
+                               "`ip_pools`.`free` = `ip_pools`.`free` + 1 "
+                       "WHERE "
+                               "`ips`.`rsv_by` = '%s' AND "
+                               "`ips`.`ip` BETWEEN `ip_pools`.`ip_start` AND `ip_pools`.`ip_stop`",
+                   inst->db_name, inst->free_after, sessid)) {
+                       sql_release_socket(inst->sqlinst, sqlsock);
+                       return RLM_MODULE_FAIL;
+               }
+               nvp_finish(inst, sqlsock);
+               break;
 
-                       nasip.s_addr = vp->vp_ipaddr;
-                       strlcpy(nasipstr, inet_ntoa(nasip), sizeof(nasipstr));
+       case PW_STATUS_ACCOUNTING_OFF:
+       case PW_STATUS_ACCOUNTING_ON:
+               vp = pairfind(request->packet->vps, PW_NAS_IP_ADDRESS, 0, TAG_ANY);
+               if (!vp) {
+                       nvp_log(__LINE__, inst, L_ERR, "mod_accounting(): no NAS IP");
+                       sql_release_socket(inst->sqlinst, sqlsock);
+                       return RLM_MODULE_FAIL;
+               }
 
-                       if (!nvp_query(__LINE__, inst, sqlsock,
-                           "UPDATE `%s`.`ips`, `radacct` "
-                               "SET `ips`.`rsv_until` = NOW() + INTERVAL %u SECOND "
-                               "WHERE "
-                                       "`radacct`.`nasipaddress` = '%s' AND "
-                                       "`ips`.`rsv_by` = `radacct`.`acctuniqueid`",
-                           inst->db_name, inst->free_after, nasipstr)) {
-                               sql_release_socket(inst->sqlinst, sqlsock);
-                               return RLM_MODULE_FAIL;
-                       }
-                       nvp_finish(inst, sqlsock);
+               nasip.s_addr = vp->vp_ipaddr;
+               strlcpy(nasipstr, inet_ntoa(nasip), sizeof(nasipstr));
+
+               if (!nvp_query(__LINE__, inst, sqlsock,
+                   "UPDATE `%s`.`ips`, `radacct` "
+                       "SET `ips`.`rsv_until` = NOW() + INTERVAL %u SECOND "
+                       "WHERE "
+                               "`radacct`.`nasipaddress` = '%s' AND "
+                               "`ips`.`rsv_by` = `radacct`.`acctuniqueid`",
+                   inst->db_name, inst->free_after, nasipstr)) {
+                       sql_release_socket(inst->sqlinst, sqlsock);
+                       return RLM_MODULE_FAIL;
+               }
+               nvp_finish(inst, sqlsock);
 
-                       break;
+               break;
        }
 
        sql_release_socket(inst->sqlinst, sqlsock);
index 0539109..6f2a8a6 100644 (file)
@@ -399,32 +399,35 @@ static rlm_rcode_t CC_HINT(nonnull) mod_accounting(void *instance, REQUEST *requ
             vp;
             vp = fr_cursor_next(&cursor)) {
                if (!vp->da->vendor) switch (vp->da->attr) {
-                       case PW_USER_NAME:
-                               if (vp->length >= sizeof(ut.ut_name)) {
-                                       memcpy(ut.ut_name, vp->vp_strvalue, sizeof(ut.ut_name));
-                               } else {
-                                       strlcpy(ut.ut_name, vp->vp_strvalue, sizeof(ut.ut_name));
-                               }
-                               break;
-                       case PW_LOGIN_IP_HOST:
-                       case PW_FRAMED_IP_ADDRESS:
-                               framed_address = vp->vp_ipaddr;
+               case PW_USER_NAME:
+                       if (vp->length >= sizeof(ut.ut_name)) {
+                               memcpy(ut.ut_name, vp->vp_strvalue, sizeof(ut.ut_name));
+                       } else {
+                               strlcpy(ut.ut_name, vp->vp_strvalue, sizeof(ut.ut_name));
+                       }
+                       break;
+
+               case PW_LOGIN_IP_HOST:
+               case PW_FRAMED_IP_ADDRESS:
+                       framed_address = vp->vp_ipaddr;
                                break;
 #ifdef USER_PROCESS
-                       case PW_FRAMED_PROTOCOL:
-                               protocol = vp->vp_integer;
-                               break;
+               case PW_FRAMED_PROTOCOL:
+                       protocol = vp->vp_integer;
+                       break;
 #endif
-                       case PW_NAS_IP_ADDRESS:
-                               nas_address = vp->vp_ipaddr;
-                               break;
-                       case PW_NAS_PORT:
-                               nas_port = vp->vp_integer;
-                               port_seen = true;
-                               break;
-                       case PW_ACCT_DELAY_TIME:
-                               delay = vp->vp_ipaddr;
-                               break;
+               case PW_NAS_IP_ADDRESS:
+                       nas_address = vp->vp_ipaddr;
+                       break;
+
+               case PW_NAS_PORT:
+                       nas_port = vp->vp_integer;
+                       port_seen = true;
+                       break;
+
+               case PW_ACCT_DELAY_TIME:
+                       delay = vp->vp_ipaddr;
+                       break;
                }
        }