Navigation


Changeset 162:79768bf7d208 in freeDiameter for extensions/acl_wl


Ignore:
Timestamp:
Jan 26, 2010, 1:23:03 PM (14 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Completed whitelist extension

Location:
extensions/acl_wl
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • extensions/acl_wl/CMakeLists.txt

    r161 r162  
    88
    99# List of source files
    10 SET( APP_TEST_SRC
     10SET( ACL_WL_SRC
    1111        acl_wl.h
    1212        acl_wl.c
     
    1818
    1919# Compile as a module
    20 FD_ADD_EXTENSION(acl_wl ${APP_TEST_SRC})
     20FD_ADD_EXTENSION(acl_wl ${ACL_WL_SRC})
  • extensions/acl_wl/acl_wl.c

    r161 r162  
    7171       
    7272        /* Now, if we did not specify any flag, reject */
     73        if (res == 0) {
     74                TRACE_DEBUG(INFO, "Peer '%s' rejected, only TLS-protected connection is whitelisted.", info->pi_diamid);
     75                /* We don't actually set *auth = -1, leave space for a further extension to validate the peer */
     76                return 0;
     77        }
    7378       
    74 
     79        /* Check the Inband-Security-Id value */
     80        res &= info->runtime.pir_isi;
     81        if (res == 0) {
     82                TRACE_DEBUG(INFO, "Peer '%s' rejected, remotely advertised Inband-Security-Id is not compatible with whitelist flags.", info->pi_diamid);
     83                /* We don't actually set *auth = -1, leave space for a further extension to validate the peer */
     84                return 0;
     85        }
     86       
     87        /* Ok, the peer is whitelisted */
     88        *auth = 1;
     89       
     90        /* Now, configure the peer for the authorized mechanism */
     91        if ((res & PI_SEC_NONE) && (res & PI_SEC_TLS_OLD))
     92                res = PI_SEC_NONE; /* If we authorized it, we must have an IPsec tunnel setup, no need for TLS in this case */
     93       
     94        /* Save information about the security mechanism to use after CER/CEA exchange */
     95        info->config.pic_flags.sec = res;
     96        return 0;
    7597}
    7698
     
    79101{
    80102        TRACE_ENTRY("%p", conffile);
    81        
    82103        CHECK_PARAMS(conffile);
    83104       
     
    86107       
    87108        TRACE_DEBUG(INFO, "Extension ACL_wl initialized with configuration: '%s'", conffile);
    88         aw_tree_dump();
     109        if (TRACE_BOOL(ANNOYING)) {
     110                aw_tree_dump();
     111        }
    89112       
    90113        /* Register the validator function */
    91        
     114        CHECK_FCT( fd_peer_validate_register ( aw_validate ) );
     115
    92116        return 0;
    93117}
     
    96120void fd_ext_fini(void)
    97121{
    98         /* Unregister the validator function */
    99 
    100122        /* Destroy the tree */
    101 
     123        aw_tree_destroy();
    102124}
    103125
  • extensions/acl_wl/aw_tree.c

    r161 r162  
    230230                ti = (struct tree_item *)(senti->next);
    231231                if (ti->str == NULL) {
    232                         fd_log_debug("[acl_wl] Warning: entry '%s' is superseeded by a generic entry at level %d, ignoring.\n", name, lbl);
     232                        fd_log_debug("[acl_wl] Warning: entry '%s' is superseeded by a generic entry at label %d, ignoring.\n", name, lbl + 1);
    233233                        return 0;
    234234                }
     
    287287                        ti = (struct tree_item *)(senti->next);
    288288                        if (ti->str == NULL) {
    289                                 fd_log_debug("[acl_wl] Warning: entry '%s' is superseeded by a generic entry at level 0, ignoring.\n", name);
     289                                fd_log_debug("[acl_wl] Warning: entry '%s' is superseeded by a generic entry at label 1, ignoring.\n", name);
    290290                                return 0;
    291291                        }
     
    367367                ti = (struct tree_item *)(senti->next);
    368368                if (ti->str == NULL) {
    369                         TRACE_DEBUG(FULL, "[acl_wl] %s matched at level %d with a generic entry.", name, lbl);
     369                        TRACE_DEBUG(ANNOYING, "[acl_wl] %s matched at label %d with a generic entry.", name, lbl + 1);
    370370                        *result = ti->flags;
    371371                        return 0;
     
    407407                return 0;
    408408       
    409         TRACE_DEBUG(FULL, "[acl_wl] %s matched exactly.", name);
     409        TRACE_DEBUG(ANNOYING, "[acl_wl] %s matched exactly.", name);
    410410        *result = ti->flags;
    411411        return 0;
Note: See TracChangeset for help on using the changeset viewer.