]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
consistify names
authorAlan T. DeKok <aland@freeradius.org>
Wed, 3 May 2017 19:14:19 +0000 (15:14 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 3 May 2017 19:14:19 +0000 (15:14 -0400)
src/protocols/radius/decode.c
src/protocols/radius/encode.c

index 0e6fad2294f1df8e26229b6634f3a057a595973d..f85616e05b64520098c29f22350873e64c951010 100644 (file)
@@ -915,7 +915,7 @@ ssize_t fr_radius_decode_pair_value(TALLOC_CTX *ctx, vp_cursor_t *cursor, fr_dic
        VALUE_PAIR              *vp;
        uint8_t const           *p = data;
        uint8_t                 buffer[256];
-       fr_radius_ctx_t         *this = decoder_ctx;
+       fr_radius_ctx_t         *packet_ctx = decoder_ctx;
 
        if (!parent || (attr_len > packet_len) || (attr_len > 128 * 1024)) {
                fr_strerror_printf("%s: Invalid arguments", __FUNCTION__);
@@ -966,7 +966,7 @@ ssize_t fr_radius_decode_pair_value(TALLOC_CTX *ctx, vp_cursor_t *cursor, fr_dic
        /*
         *      Decrypt the attribute.
         */
-       if (this && this->secret && this->packet && (parent->flags.encrypt != FLAG_ENCRYPT_NONE)) {
+       if (packet_ctx && (parent->flags.encrypt != FLAG_ENCRYPT_NONE)) {
                FR_PROTO_TRACE("Decrypting type %u", parent->flags.encrypt);
                /*
                 *      Encrypted attributes can only exist for the
@@ -983,12 +983,12 @@ ssize_t fr_radius_decode_pair_value(TALLOC_CTX *ctx, vp_cursor_t *cursor, fr_dic
                 *  User-Password
                 */
                case FLAG_ENCRYPT_USER_PASSWORD:
-                       if (this->original) {
+                       if (packet_ctx->original) {
                                fr_radius_decode_password((char *)buffer, attr_len,
-                                                         this->secret, this->original->vector);
+                                                         packet_ctx->secret, packet_ctx->original->vector);
                        } else {
                                fr_radius_decode_password((char *)buffer, attr_len,
-                                                         this->secret, this->packet->vector);
+                                                         packet_ctx->secret, packet_ctx->packet->vector);
                        }
                        buffer[253] = '\0';
 
@@ -1022,8 +1022,8 @@ ssize_t fr_radius_decode_pair_value(TALLOC_CTX *ctx, vp_cursor_t *cursor, fr_dic
                 *      not the same as attrlen.
                 */
                case FLAG_ENCRYPT_TUNNEL_PASSWORD:
-                       if (fr_radius_decode_tunnel_password(buffer, &data_len, this->secret,
-                                                            this->original ? this->original->vector : nullvector) < 0) {
+                       if (fr_radius_decode_tunnel_password(buffer, &data_len, packet_ctx->secret,
+                                                            packet_ctx->original ? packet_ctx->original->vector : nullvector) < 0) {
                                goto raw;
                        }
                        break;
@@ -1033,9 +1033,9 @@ ssize_t fr_radius_decode_pair_value(TALLOC_CTX *ctx, vp_cursor_t *cursor, fr_dic
                 *      Ascend-Receive-Secret
                 */
                case FLAG_ENCRYPT_ASCEND_SECRET:
-                       if (!this->original) goto raw;
+                       if (!packet_ctx->original) goto raw;
 
-                       fr_radius_ascend_secret(buffer, this->original->vector, this->secret, p);
+                       fr_radius_ascend_secret(buffer, packet_ctx->original->vector, packet_ctx->secret, p);
                        buffer[AUTH_VECTOR_LEN] = '\0';
                        data_len = strlen((char *) buffer);
                        break;
index 507995fad37749f5ff181767662fca4b65a9562d..b396913a609986fc8bcb45a9c6ce543ed48bb6b9 100644 (file)
@@ -699,7 +699,7 @@ static ssize_t encode_value(uint8_t *out, size_t outlen,
        uint8_t                 buffer[64];
        VALUE_PAIR const        *vp = fr_pair_cursor_current(cursor);
        fr_dict_attr_t const    *da = tlv_stack[depth];
-       fr_radius_ctx_t *ctx = encoder_ctx;
+       fr_radius_ctx_t         *packet_ctx = encoder_ctx;
 
        VERIFY_VP(vp);
        FR_PROTO_STACK_PRINT(tlv_stack, depth);
@@ -813,7 +813,7 @@ static ssize_t encode_value(uint8_t *out, size_t outlen,
         */
        if (len > (ssize_t)outlen) len = outlen;
 
-       if (vp->da->flags.encrypt && !ctx) {
+       if (vp->da->flags.encrypt && !packet_ctx) {
        no_ctx_error:
                fr_strerror_printf("Asked to encrypt attribute, but no packet context provided");
                return -1;
@@ -826,7 +826,7 @@ static ssize_t encode_value(uint8_t *out, size_t outlen,
         */
        if (da->type != PW_TYPE_STRUCT) switch (vp->da->flags.encrypt) {
        case FLAG_ENCRYPT_USER_PASSWORD:
-               encode_password(ptr, &len, data, len, ctx->secret, ctx->packet->vector);
+               encode_password(ptr, &len, data, len, packet_ctx->secret, packet_ctx->packet->vector);
                break;
 
        case FLAG_ENCRYPT_TUNNEL_PASSWORD:
@@ -842,23 +842,23 @@ static ssize_t encode_value(uint8_t *out, size_t outlen,
                 */
                if (outlen < (18 + offset)) return 0;
 
-               switch (ctx->packet->code) {
+               switch (packet_ctx->packet->code) {
                case PW_CODE_ACCESS_ACCEPT:
                case PW_CODE_ACCESS_REJECT:
                case PW_CODE_ACCESS_CHALLENGE:
                default:
-                       if (!ctx->original) goto no_ctx_error;
+                       if (!packet_ctx->original) goto no_ctx_error;
 
                        if (offset) ptr[0] = TAG_VALID(vp->tag) ? vp->tag : TAG_NONE;
                        encode_tunnel_password(ptr + offset, &len, data, len,
-                                              outlen - offset, ctx->secret, ctx->original->vector);
+                                              outlen - offset, packet_ctx->secret, packet_ctx->original->vector);
                        len += offset;
                        break;
                case PW_CODE_ACCOUNTING_REQUEST:
                case PW_CODE_DISCONNECT_REQUEST:
                case PW_CODE_COA_REQUEST:
                        ptr[0] = TAG_VALID(vp->tag) ? vp->tag : TAG_NONE;
-                       encode_tunnel_password(ptr + 1, &len, data, len, outlen - 1, ctx->secret, ctx->packet->vector);
+                       encode_tunnel_password(ptr + 1, &len, data, len, outlen - 1, packet_ctx->secret, packet_ctx->packet->vector);
                        len += offset;
                        break;
                }
@@ -871,7 +871,7 @@ static ssize_t encode_value(uint8_t *out, size_t outlen,
        case FLAG_ENCRYPT_ASCEND_SECRET:
                if (len != 16) return 0;
 
-               fr_radius_ascend_secret(ptr, ctx->packet->vector, ctx->secret, data);
+               fr_radius_ascend_secret(ptr, packet_ctx->packet->vector, packet_ctx->secret, data);
                len = AUTH_VECTOR_LEN;
                break;