Chinaunix首页 | 论坛 | 博客
  • 博客访问: 682498
  • 博文数量: 85
  • 博客积分: 1797
  • 博客等级: 上尉
  • 技术积分: 1238
  • 用 户 组: 普通用户
  • 注册时间: 2007-12-02 08:53
个人简介

职位:技术总监 1、精通c++(linux平台、vc++Mfc、qt)、java、php、unity3d,略懂python 2、用c++开发过嵌入式产品,用c++开发过大型银行运维产品 3、用java开发大型银行运维产品,学校教务系统 4、用php开发进销存系统(在销售中),用php开发淘宝小程序 5、用unity3d开发衣柜设计软件,在运营中

文章分类

全部博文(85)

分类: LINUX

2010-03-27 19:33:56

      调试分日志信息调试和gdb跟踪调试。
 
1、日志信息调试
     

      1)进入radius目录

      cd freeradius-server-2.1.8/src/main/

      2)加-X选项,输出日志信息
      Radiusd -X


2、gdb跟踪调试

      cd freeradius-server-2.1.8/src/main/.libs
      Gdb radiusd
      run  -X    (必须加-X参数,否则无法进行gdb调试

      注意上面两个目录是不一样的

      src/main/目录下的radius只是个启动radiusd的脚本

       src/main/.libs目录下的radiusd才是radius程序

 

       下面是gdb调试的一些信息,从中能看出很多信息

789 radlog(L_INFO, "geng: buffer: %s", buffer);
(gdb)
geng: buffer: /usr/local/etc/raddb/radiusd.conf
791 if ((cs = cf_file_read(buffer)) == NULL) {
(gdb)
including configuration file /usr/local/etc/raddb/radiusd.conf
including configuration file /usr/local/etc/raddb/proxy.conf
including configuration file /usr/local/etc/raddb/clients.conf
including files in directory /usr/local/etc/raddb/modules/
including configuration file /usr/local/etc/raddb/modules/detail
including configuration file /usr/local/etc/raddb/modules/acct_unique
including configuration file /usr/local/etc/raddb/modules/counter
including configuration file /usr/local/etc/raddb/modules/ippool
including configuration file /usr/local/etc/raddb/modules/always
including configuration file /usr/local/etc/raddb/modules/radutmp
including configuration file /usr/local/etc/raddb/modules/chap
including configuration file /usr/local/etc/raddb/modules/expiration
including configuration file /usr/local/etc/raddb/modules/preprocess
including configuration file /usr/local/etc/raddb/modules/echo
including configuration file /usr/local/etc/raddb/modules/wimax
including configuration file /usr/local/etc/raddb/modules/mac2ip
including configuration file /usr/local/etc/raddb/modules/detail.example.com
including configuration file /usr/local/etc/raddb/modules/krb5
including configuration file /usr/local/etc/raddb/modules/sql_log
including configuration file /usr/local/etc/raddb/modules/exec
including configuration file /usr/local/etc/raddb/modules/mschap
including configuration file /usr/local/etc/raddb/modules/pap
including configuration file /usr/local/etc/raddb/modules/pam
including configuration file /usr/local/etc/raddb/modules/policy
including configuration file /usr/local/etc/raddb/modules/perl
including configuration file /usr/local/etc/raddb/modules/sradutmp
including configuration file /usr/local/etc/raddb/modules/passwd
including configuration file /usr/local/etc/raddb/modules/cui
including configuration file /usr/local/etc/raddb/modules/detail.log
including configuration file /usr/local/etc/raddb/modules/expr
including configuration file /usr/local/etc/raddb/modules/digest
including configuration file /usr/local/etc/raddb/modules/files
including configuration file /usr/local/etc/raddb/modules/inner-eap
including configuration file /usr/local/etc/raddb/modules/ldap
including configuration file /usr/local/etc/raddb/modules/smbpasswd
including configuration file /usr/local/etc/raddb/modules/smsotp
including configuration file /usr/local/etc/raddb/modules/etc_group
including configuration file /usr/local/etc/raddb/modules/sqlcounter_expire_on_login
including configuration file /usr/local/etc/raddb/modules/checkval
including configuration file /usr/local/etc/raddb/modules/otp
including configuration file /usr/local/etc/raddb/modules/attr_rewrite
including configuration file /usr/local/etc/raddb/modules/mac2vlan
including configuration file /usr/local/etc/raddb/modules/linelog
including configuration file /usr/local/etc/raddb/modules/realm
including configuration file /usr/local/etc/raddb/modules/unix
including configuration file /usr/local/etc/raddb/modules/ntlm_auth
including configuration file /usr/local/etc/raddb/modules/attr_filter
including configuration file /usr/local/etc/raddb/modules/logintime
including configuration file /usr/local/etc/raddb/eap.conf
including configuration file /usr/local/etc/raddb/policy.conf
including files in directory /usr/local/etc/raddb/sites-enabled/
including configuration file /usr/local/etc/raddb/sites-enabled/default
including configuration file /usr/local/etc/raddb/sites-enabled/inner-tunnel
including configuration file /usr/local/etc/raddb/sites-enabled/control-socket
800 if (mainconfig.radlog_dest == RADLOG_NULL) {
(gdb) n
532 if (debug_flag && (getuid() != 0)) return 1;
(gdb) n
534 if (cf_section_parse(cs, NULL, bootstrap_config) < 0) {
(gdb)
main {
        allow_core_dumps = no
}
542 if (gid_name) {
(gdb)
553 server_gid = getgid();
(gdb)
559 if (uid_name) {
(gdb)
583 server_uid = getuid();
(gdb)
587 if (chroot_dir) {
(gdb)
614 if (gid_name && (setgid(server_gid) < 0)) {
(gdb)
626 if (uid_name || gid_name) {
(gdb)
659 if (getrlimit(RLIMIT_CORE, &core_limits) < 0) {
(gdb)
673 if (!(debug_flag || allow_core_dumps || doing_setuid)) {
(gdb)
850 cp = cf_pair_find(cs, "dictionary");
(gdb)
851 if (cp) p = cf_pair_value(cp);
(gdb)
852 if (!p) p = radius_dir;
(gdb)
853 DEBUG2("including dictionary file %s/%s", p, RADIUS_DICTIONARY);(gdb)
including dictionary file /usr/local/etc/raddb/dictionary
854 if (dict_init(p, RADIUS_DICTIONARY) != 0) {
(gdb)
864 cf_section_parse(cs, NULL, server_config);
(gdb)
main {
        prefix = "/usr/local"
        localstatedir = "/usr/local/var"
        logdir = "/usr/local/var/log/radius"
        libdir = "/usr/local/lib"
        radacctdir = "/usr/local/var/log/radius/radacct"
        hostname_lookups = no
        max_request_time = 30
        cleanup_delay = 5
        max_requests = 1024
        pidfile = "/usr/local/var/run/radiusd/radiusd.pid"
        checkrad = "/usr/local/sbin/checkrad"
        debug_level = 0
        proxy_requests = yes
 log {
        stripped_names = no
        auth = no
        auth_badpass = no
        auth_goodpass = no
 }
 security {
        max_attributes = 200
        reject_delay = 1
        status_server = yes
 }
}
873 cf_section_free(&mainconfig.config);
(gdb)
876 DEBUG2("%s: #### Loading Realms and Home Servers ####", mainconfig.name);
(gdb)
874 mainconfig.config = cs;
(gdb)
876 DEBUG2("%s: #### Loading Realms and Home Servers ####", mainconfig.name);
(gdb)
874 mainconfig.config = cs;
(gdb)
876 DEBUG2("%s: #### Loading Realms and Home Servers ####", mainconfig.name);
(gdb)
radiusd: #### Loading Realms and Home Servers ####
877 if (!realms_init(cs)) {
(gdb)
 proxy server {
        retry_delay = 5
        retry_count = 3
        default_fallback = no
        dead_time = 120
        wake_all_if_all_dead = no
 }
 home_server localhost {
        ipaddr = 127.0.0.1
        port = 1812
        type = "auth"
        secret = "testing123"
        response_window = 20
        max_outstanding = 65536
        require_message_authenticator = no
        zombie_period = 40
        status_check = "status-server"
        ping_interval = 30
        check_interval = 30
        num_answers_to_alive = 3
        num_pings_to_alive = 3
        revive_interval = 120
        status_check_timeout = 4
        irt = 2
        mrt = 16
        mrc = 5
        mrd = 30
 }
 home_server_pool my_auth_failover {
        type = fail-over
        home_server = localhost
 }
 realm example.com {
        auth_pool = my_auth_failover
 }
 realm LOCAL {
 }
878    return -1;
882 if (!clients_parse_section(cs)) {
(gdb)
 client localhost {
        ipaddr = 127.0.0.1
        require_message_authenticator = no
        secret = "testing123"
        nastype = "other"
 }
 client 192.168.1.180 {
        require_message_authenticator = no
        secret = "testing123"
        shortname = "private-network-1"
 }
883    return -1;
917 if (setup_modules(reload, mainconfig.config) < 0) {
(gdb)
radiusd: #### Instantiating modules ####
 instantiate {
name1: exec modules.c 559
 Module: Linked to module rlm_exec modules.c 490
 Module: Instantiating exec
  exec {
        wait = no
        input_pairs = "request"
        shell_escape = yes
  }
name1: expr modules.c 559
 Module: Linked to module rlm_expr modules.c 490
 Module: Instantiating expr
name1: expiration modules.c 559
 Module: Linked to module rlm_expiration modules.c 490
 Module: Instantiating expiration
  expiration {
        reply-message = "Password Has Expired "
  }
name1: logintime modules.c 559
 Module: Linked to module rlm_logintime modules.c 490
 Module: Instantiating logintime
  logintime {
        reply-message = "You are calling outside your allowed timespan "
        minimum-timeout = 60
  }
 }
radiusd: #### Loading Virtual Servers ####
server inner-tunnel {
 modules {
 Module: Checking authenticate {...} for more modules to load
name1: pap modules.c 559
 Module: Linked to module rlm_pap modules.c 490
 Module: Instantiating pap
  pap {
        encryption_scheme = "auto"
        auto_header = no
  }
name1: chap modules.c 559
 Module: Linked to module rlm_chap modules.c 490
 Module: Instantiating chap
name1: mschap modules.c 559
 Module: Linked to module rlm_mschap modules.c 490
 Module: Instantiating mschap
  mschap {
        use_mppe = yes
        require_encryption = no
        require_strong = no
        with_ntdomain_hack = no
  }
name1: unix modules.c 559
 Module: Linked to module rlm_unix modules.c 490
 Module: Instantiating unix
  unix {
        radwtmp = "/usr/local/var/log/radius/radwtmp"
  }
name1: eap modules.c 559
 Module: Linked to module rlm_eap modules.c 490
 Module: Instantiating eap
  eap {
        default_eap_type = "md5"
        timer_expire = 60
        ignore_unknown_eap_types = no
        cisco_accounting_username_bug = no
        max_sessions = 4096
  }
 Module: Linked to sub-module rlm_eap_md5
 Module: Instantiating eap-md5
 Module: Linked to sub-module rlm_eap_leap
 Module: Instantiating eap-leap
 Module: Linked to sub-module rlm_eap_gtc
 Module: Instantiating eap-gtc
   gtc {
        challenge = "Password: "
        auth_type = "PAP"
   }
 Module: Linked to sub-module rlm_eap_tls
 Module: Instantiating eap-tls
   tls {
        rsa_key_exchange = no
        dh_key_exchange = yes
        rsa_key_length = 512
        dh_key_length = 512
        verify_depth = 0
        pem_file_type = yes
        private_key_file = "/usr/local/etc/raddb/certs/server.pem"
        certificate_file = "/usr/local/etc/raddb/certs/server.pem"
        CA_file = "/usr/local/etc/raddb/certs/ca.pem"
        private_key_password = "whatever"
        dh_file = "/usr/local/etc/raddb/certs/dh"
        random_file = "/usr/local/etc/raddb/certs/random"
        fragment_size = 1024
        include_length = yes
        check_crl = no
        cipher_list = "DEFAULT"
        make_cert_command = "/usr/local/etc/raddb/certs/bootstrap"
    cache {
        enable = no
        lifetime = 24
        max_entries = 255
    }
   }
 Module: Linked to sub-module rlm_eap_ttls
 Module: Instantiating eap-ttls
   ttls {
        default_eap_type = "md5"
        copy_request_to_tunnel = no
        use_tunneled_reply = no
        virtual_server = "inner-tunnel"
        include_length = yes
   }
 Module: Linked to sub-module rlm_eap_peap
 Module: Instantiating eap-peap
   peap {
        default_eap_type = "mschapv2"
        copy_request_to_tunnel = no
        use_tunneled_reply = no
        proxy_tunneled_request_as_eap = yes
        virtual_server = "inner-tunnel"
   }
 Module: Linked to sub-module rlm_eap_mschapv2
 Module: Instantiating eap-mschapv2
   mschapv2 {
        with_ntdomain_hack = no
   }
 Module: Checking authorize {...} for more modules to load
name1: realm modules.c 559
 Module: Linked to module rlm_realm modules.c 490
 Module: Instantiating suffix
  realm suffix {
        format = "suffix"
        delimiter = "@"
        ignore_default = no
        ignore_null = no
  }
name1: files modules.c 559
 Module: Linked to module rlm_files modules.c 490
 Module: Instantiating files
  files {
        usersfile = "/usr/local/etc/raddb/users"
        acctusersfile = "/usr/local/etc/raddb/acct_users"
        preproxy_usersfile = "/usr/local/etc/raddb/preproxy_users"
        compat = "no"
  }
 Module: Checking session {...} for more modules to load
name1: radutmp modules.c 559
 Module: Linked to module rlm_radutmp modules.c 490
 Module: Instantiating radutmp
  radutmp {
        filename = "/usr/local/var/log/radius/radutmp"
        username = "%{User-Name}"
        case_sensitive = yes
        check_with_nas = yes
        perm = 384
        callerid = yes
  }
 Module: Checking post-proxy {...} for more modules to load
 Module: Checking post-auth {...} for more modules to load
name1: attr_filter modules.c 559
 Module: Linked to module rlm_attr_filter modules.c 490
 Module: Instantiating attr_filter.access_reject
  attr_filter attr_filter.access_reject {
        attrsfile = "/usr/local/etc/raddb/attrs.access_reject"
        key = "%{User-Name}"
  }
 } # modules
} # server
server {
 modules {
 Module: Checking authenticate {...} for more modules to load
 Module: Checking authorize {...} for more modules to load
name1: preprocess modules.c 559
 Module: Linked to module rlm_preprocess modules.c 490
 Module: Instantiating preprocess
  preprocess {
        huntgroups = "/usr/local/etc/raddb/huntgroups"
        hints = "/usr/local/etc/raddb/hints"
        with_ascend_hack = no
        ascend_channels_per_line = 23
        with_ntdomain_hack = no
        with_specialix_jetstream_hack = no
        with_cisco_vsa_hack = no
        with_alvarion_vsa_hack = no
  }
 Module: Checking preacct {...} for more modules to load
name1: acct_unique modules.c 559
 Module: Linked to module rlm_acct_unique modules.c 490
 Module: Instantiating acct_unique
  acct_unique {
        key = "User-Name, Acct-Session-Id, NAS-IP-Address, Client-IP-Address, NAS-Port"
  }
 Module: Checking accounting {...} for more modules to load
name1: detail modules.c 559
 Module: Linked to module rlm_detail modules.c 490
 Module: Instantiating detail
  detail {
        detailfile = "/usr/local/var/log/radius/radacct/%{Client-IP-Address}/detail-%Y%m%d"
        header = "%t"
        detailperm = 384
        dirperm = 493
        locking = no
        log_packet_header = no
  }
name1: attr_filter modules.c 559
 Module: Instantiating attr_filter.accounting_response
  attr_filter attr_filter.accounting_response {
        attrsfile = "/usr/local/etc/raddb/attrs.accounting_response"
        key = "%{User-Name}"
  }
 Module: Checking session {...} for more modules to load
 Module: Checking post-proxy {...} for more modules to load
 Module: Checking post-auth {...} for more modules to load
 } # modules
} # server
918    return -1;
Breakpoint 2, file_authorize (instance=0x1, request=0xa0600c8) at rlm_files.c:521
521 radlog(L_INFO, "geng: %s", __FUNCTION__);
(gdb) bt
#0 file_authorize (instance=0x1, request=0xa0600c8) at rlm_files.c:521
#1 0x08060a9e in modcall (component=1, c=0xa054920, request=0xa0600c8) at modcall.c:297
#2 0x0805eb1d in indexed_modcall (comp=1, idx=0, request=0xa0600c8) at modules.c:720
#3 0x0805fc2c in module_authorize (autz_type=168118560, request=0xa054920)
    at modules.c:1482
#4 0x0804e926 in rad_authenticate (request=0xa0600c8) at auth.c:565
#5 0x0806d4fc in radius_handle_request (request=0xa0600c8,
    fun=0x804e810 <rad_authenticate>) at event.c:3708
#6 0x0806557c in thread_pool_addrequest (request=0xa0600c8,
    fun=0x804e810 <rad_authenticate>) at threads.c:841
#7 0x0806eae2 in event_socket_handler (xel=0xa05b260, fd=8, ctx=0x9e0f60) at event.c:3349
#8 0x009b838c in fr_event_loop (el=0xa05b260) at event.c:412
#9 0x0806f0ca in radius_event_process () at event.c:3694
#10 0x080631e6 in main (argc=2, argv=0xbfe20e84) at radiusd.c:403

432 name = namepair ? (char *) namepair->vp_strvalue : "NONE"; (gdb) p *namepair
$7 = {name = 0x9f67620 "User-Name", attribute = 1, vendor = 0, type = 0, length = 4,
  operator = T_OP_EQ, flags = {addport = 0, has_tag = 0, do_xlat = 0, unknown_attr = 0,
    array = 0, has_value = 0, has_value_alias = 0, has_tlv = 0, is_tlv = 0, encoded = 0,
    tag = 0 '\0', encrypt = 0 '\0'}, next = 0xa060338, lvalue = 0, data = {
    strvalue = "geng", '\0' <repeats 249 times>,
    octets = "geng", '\0' <repeats 249 times>, ipaddr = {s_addr = 1735288167},
    ipv6addr = {in6_u = {u6_addr8 = "geng", '\0' <repeats 11 times>, u6_addr16 = {25959,
          26478, 0, 0, 0, 0, 0, 0}, u6_addr32 = {1735288167, 0, 0, 0}}},
    date = 1735288167, integer = 1735288167, sinteger = 1735288167,
    filter = "geng", '\0' <repeats 27 times>, ifid = "geng\000\000\000",
    ipv6prefix = "geng", '\0' <repeats 13 times>, ether = "geng\000",
    tlv = 0x676e6567 <Address 0x676e6567 out of bounds>}}
442 config_pairs = &request->config_items;
(gdb)
444 if (!ht) return RLM_MODULE_NOOP;
(gdb)
447 user_pl = fr_hash_table_finddata(ht, &my_pl);
(gdb) p **config_pairs
$12 = {name = 0xa033660 "Auth-Type", attribute = 1000, vendor = 0, type = 1, length = 4,
  operator = T_OP_EQ, flags = {addport = 0, has_tag = 0, do_xlat = 0, unknown_attr = 0,
    array = 0, has_value = 1, has_value_alias = 0, has_tlv = 0, is_tlv = 0, encoded = 0,
    tag = 0 '\0', encrypt = 0 '\0'}, next = 0x0, lvalue = 1025, data = {
    strvalue = "CHAP", '\0' <repeats 249 times>,
    octets = "CHAP", '\0' <repeats 249 times>, ipaddr = {s_addr = 1346455619},
    ipv6addr = {in6_u = {u6_addr8 = "CHAP", '\0' <repeats 11 times>, u6_addr16 = {18499,
          20545, 0, 0, 0, 0, 0, 0}, u6_addr32 = {1346455619, 0, 0, 0}}},
    date = 1346455619, integer = 1346455619, sinteger = 1346455619,
    filter = "CHAP", '\0' <repeats 27 times>, ifid = "CHAP\000\000\000",
    ipv6prefix = "CHAP", '\0' <repeats 13 times>, ether = "CHAP\000",
    tlv = 0x50414843 <Address 0x50414843 out of bounds>}}
(gdb) p *ht
$14 = {num_elements = 168165592, num_buckets = 0, next_grow = 2, mask = 88, free = 0x31,
  hash = 0x91dc668, cmp = 0x5c0880 <main_arena+96>, null = {next = 0x68, reversed = 33,
    key = 6031448, data = 0x5c0858}, buckets = 0x78}
(gdb) n
447 user_pl = fr_hash_table_finddata(ht, &my_pl);
(gdb) p *user_pl
$20 = {name = 0x0, check = 0x0, reply = 0x0, lineno = 0, order = 0, next = 0x0,
  lastdefault = 0x0}
(gdb) n
geng: pairlist_hash
geng: pairlist_cmp
448 my_pl.name = "DEFAULT";
(gdb) p *user_pl
$21 = {name = 0xa05467c "geng", check = 0xa054c50, reply = 0xa054d78, lineno = 76,
  order = 0, next = 0x0, lastdefault = 0x0}
(gdb) p name
$22 = 0xa060234 "geng"
382 for (check_item = check; check_item != NULL; check_item = check_item->next) {
(gdb) p check
$23 = (VALUE_PAIR *) 0xa054c50
(gdb) p *check
$24 = {name = 0xa0343e0 "Cleartext-Password", attribute = 1100, vendor = 0, type = 0,
  length = 4, operator = T_OP_SET, flags = {addport = 0, has_tag = 0, do_xlat = 0,
    unknown_attr = 0, array = 0, has_value = 0, has_value_alias = 0, has_tlv = 0,
    is_tlv = 0, encoded = 0, tag = 0 '\0', encrypt = 0 '\0'}, next = 0x0, lvalue = 0,
  data = {strvalue = "peng", '\0' <repeats 249 times>,
    octets = "peng", '\0' <repeats 249 times>, ipaddr = {s_addr = 1735288176},
    ipv6addr = {in6_u = {u6_addr8 = "peng", '\0' <repeats 11 times>, u6_addr16 = {25968,
          26478, 0, 0, 0, 0, 0, 0}, u6_addr32 = {1735288176, 0, 0, 0}}},
    date = 1735288176, integer = 1735288176, sinteger = 1735288176,
    filter = "peng", '\0' <repeats 27 times>, ifid = "peng\000\000\000",
    ipv6prefix = "peng", '\0' <repeats 13 times>, ether = "peng\000",
    tlv = 0x676e6570 <Address 0x676e6570 out of bounds>}}


阅读(5807) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~