Changeset 1681
- Timestamp:
- 02/17/10 16:52:56 (7 months ago)
- Location:
- trunk
- Files:
-
- 4 modified
-
include/interface.h (modified) (3 diffs)
-
modules/nickserv.c (modified) (5 diffs)
-
modules/oftc.c (modified) (13 diffs)
-
src/interface.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/interface.h
r1559 r1681 54 54 extern struct Callback *send_chops_notice_cb; 55 55 extern struct Callback *send_squit_cb; 56 extern struct Callback *send_autojoin_cb; 57 extern struct Callback *send_auth_cb; 56 58 57 59 extern struct Callback *on_umode_change_cb; … … 79 81 extern struct Callback *on_db_init_cb; 80 82 extern struct Callback *on_ctcp_cb; 83 extern struct Callback *on_auth_request_cb; 81 84 82 85 extern struct Callback *do_event_cb; … … 114 117 void send_kill(struct Service *, struct Client *, const char *); 115 118 void set_limit(struct Service *, struct Channel *, int); 119 void send_auth_reply(struct Service *, char *, char *, int, char *); 116 120 117 121 unsigned int enforce_mode_lock(struct Service *, struct Channel *, const char *, char *, -
trunk/modules/nickserv.c
r1592 r1681 53 53 static dlink_node *ns_quit_hook; 54 54 static dlink_node *ns_certfp_hook; 55 static dlink_node *ns_on_auth_req_hook; 55 56 56 57 static dlink_list nick_enforce_list = { NULL, NULL, 0 }; … … 67 68 static void *ns_on_quit(va_list); 68 69 static void *ns_on_certfp(va_list); 70 static void *ns_on_auth_requested(va_list); 69 71 static void m_drop(struct Service *, struct Client *, int, char *[]); 70 72 static void m_help(struct Service *, struct Client *, int, char *[]); … … 304 306 ns_quit_hook = install_hook(on_quit_cb, ns_on_quit); 305 307 ns_certfp_hook = install_hook(on_certfp_cb, ns_on_certfp); 308 ns_on_auth_req_hook = install_hook(on_auth_request_cb, ns_on_auth_requested); 306 309 307 310 guest_number = 0; … … 319 322 uninstall_hook(on_quit_cb, ns_on_quit); 320 323 uninstall_hook(on_certfp_cb, ns_on_certfp); 324 uninstall_hook(on_auth_request_cb, ns_on_auth_requested); 321 325 eventDelete(process_enforce_list, NULL); 322 326 eventDelete(process_release_list, NULL); … … 2036 2040 } 2037 2041 2042 static void * 2043 ns_on_auth_requested(va_list args) 2044 { 2045 char *user = va_arg(args, char *); 2046 char *n = va_arg(args, char *); 2047 char *certfp = va_arg(args, char *); 2048 Nickname *nick, *nick2; 2049 2050 nick = nickname_find(user); 2051 if(nick == NULL) 2052 { 2053 send_auth_reply(nickserv, user, n, 0, "User not found"); 2054 } 2055 else 2056 { 2057 nick2 = nickname_find(n); 2058 if(nick2 == NULL) 2059 { 2060 nickname_free(nick); 2061 send_auth_reply(nickserv, user, n, 0, "Nickname not found"); 2062 return pass_callback(ns_on_auth_req_hook, user, n, certfp); 2063 } 2064 if(nickname_get_id(nick) != nickname_get_id(nick2)) 2065 { 2066 nickname_free(nick); 2067 nickname_free(nick2); 2068 send_auth_reply(nickserv, user, n, 0, "Nickname not on account"); 2069 return pass_callback(ns_on_auth_req_hook, user, n, certfp); 2070 } 2071 else 2072 { 2073 if(!nickname_cert_check(nick, certfp, NULL)) 2074 send_auth_reply(nickserv, user, n, 0, "CertFP Mismatch"); 2075 else 2076 send_auth_reply(nickserv, user, n, 1, "Success"); 2077 2078 nickname_free(nick); 2079 } 2080 2081 } 2082 2083 return pass_callback(ns_on_auth_req_hook, user); 2084 } 2085 2038 2086 static void 2039 2087 m_status(struct Service *service, struct Client *client, int parc, char *parv[]) -
trunk/modules/oftc.c
r1662 r1681 44 44 static void *oftc_sendmsg_svscloak(va_list); 45 45 static void *oftc_sendmsg_svsnick(va_list); 46 //static void *oftc_sendmsg_svsjoin(va_list);46 static void *oftc_sendmsg_svsjoin(va_list); 47 47 static void *oftc_identify(va_list); 48 48 static void *oftc_chops_notice(va_list); 49 49 static void *oftc_sendmsg_newuser(va_list); 50 50 static void *oftc_sendmsg_notice(va_list); 51 static void *oftc_sendmsg_auth(va_list); 51 52 52 53 static dlink_node *oftc_gnotice_hook; … … 54 55 static dlink_node *oftc_svscloak_hook; 55 56 static dlink_node *oftc_svsnick_hook; 56 //static dlink_node *oftc_svsjoin_hook;57 static dlink_node *oftc_svsjoin_hook; 57 58 static dlink_node *oftc_identify_hook; 58 59 static dlink_node *oftc_connected_hook; … … 60 61 static dlink_node *oftc_newuser_hook; 61 62 static dlink_node *oftc_notice_hook; 63 static dlink_node *oftc_auth_hook; 62 64 63 65 static void m_pass(struct Client *, struct Client *, int, char *[]); … … 72 74 static void m_realhost(struct Client *, struct Client *, int, char *[]); 73 75 static void m_certfp(struct Client *, struct Client *, int, char *[]); 76 static void m_auth(struct Client *, struct Client *, int, char *[]); 74 77 75 78 static struct Message gnotice_msgtab = { … … 114 117 115 118 static struct Message svsmode_msgtab = { 116 "SVSMODE", 0, 0, 2, 0, 0, 0, { m_svsmode, m_svsmode } 119 "SVSMODE", 0, 0, 2, 0, 0, 0, 120 { m_svsmode, m_svsmode } 117 121 }; 118 122 119 123 static struct Message eob_msgtab = { 120 "EOB", 0, 0, 0, 0, 0, 0, { m_eob, m_eob } 124 "EOB", 0, 0, 0, 0, 0, 0, 125 { m_eob, m_eob } 121 126 }; 122 127 123 128 static struct Message realhost_msgtab = { 124 "REALHOST", 0, 0, 3, 0, 0, 0, 129 "REALHOST", 0, 0, 3, 0, 0, 0, 125 130 { m_realhost, m_realhost } 126 131 }; … … 129 134 "CERTFP", 0, 0, 3, 0, 0, 0, 130 135 { m_certfp, m_certfp } 136 }; 137 138 static struct Message auth_msgtab = { 139 "AUTH", 0, 0, 3, 0, 0, 0, 140 { m_auth, m_auth } 131 141 }; 132 142 … … 147 157 INIT_MODULE(oftc, "$Revision$") 148 158 { 149 oftc_connected_hook = install_hook(connected_cb, oftc_server_connected); 150 oftc_gnotice_hook = install_hook(send_gnotice_cb, oftc_sendmsg_gnotice); 151 oftc_umode_hook = install_hook(send_umode_cb, oftc_sendmsg_svsmode); 152 oftc_svscloak_hook = install_hook(send_cloak_cb, oftc_sendmsg_svscloak); 153 // oftc_svsjoin_hook = install_hook(send_nick_cb, oftc_sendmsg_svsjoin); 154 oftc_svsnick_hook = install_hook(send_nick_cb, oftc_sendmsg_svsnick); 155 oftc_identify_hook = install_hook(on_identify_cb, oftc_identify); 156 oftc_chops_notice_hook = install_hook(send_chops_notice_cb, oftc_chops_notice); 157 oftc_newuser_hook = install_hook(send_newuser_cb, oftc_sendmsg_newuser); 158 oftc_notice_hook = install_hook(send_notice_cb, oftc_sendmsg_notice); 159 oftc_connected_hook = install_hook(connected_cb, oftc_server_connected); 160 oftc_gnotice_hook = install_hook(send_gnotice_cb, oftc_sendmsg_gnotice); 161 oftc_umode_hook = install_hook(send_umode_cb, oftc_sendmsg_svsmode); 162 oftc_svscloak_hook = install_hook(send_cloak_cb, oftc_sendmsg_svscloak); 163 oftc_svsjoin_hook = install_hook(send_autojoin_cb, oftc_sendmsg_svsjoin); 164 oftc_svsnick_hook = install_hook(send_nick_cb, oftc_sendmsg_svsnick); 165 oftc_identify_hook = install_hook(on_identify_cb, oftc_identify); 166 oftc_chops_notice_hook= install_hook(send_chops_notice_cb, oftc_chops_notice); 167 oftc_newuser_hook = install_hook(send_newuser_cb, oftc_sendmsg_newuser); 168 oftc_notice_hook = install_hook(send_notice_cb, oftc_sendmsg_notice); 169 oftc_auth_hook = install_hook(send_auth_cb, oftc_sendmsg_auth); 159 170 mod_add_cmd(&gnotice_msgtab); 160 171 mod_add_cmd(&pass_msgtab); … … 169 180 mod_add_cmd(&realhost_msgtab); 170 181 mod_add_cmd(&certfp_msgtab); 182 mod_add_cmd(&auth_msgtab); 183 171 184 return ModeList; 172 185 } … … 186 199 mod_del_cmd(&realhost_msgtab); 187 200 mod_del_cmd(&certfp_msgtab); 201 mod_del_cmd(&auth_msgtab); 188 202 189 203 uninstall_hook(send_gnotice_cb, oftc_sendmsg_gnotice); … … 194 208 uninstall_hook(send_newuser_cb, oftc_sendmsg_newuser); 195 209 uninstall_hook(send_notice_cb, oftc_sendmsg_notice); 210 uninstall_hook(send_auth_cb, oftc_sendmsg_auth); 211 uninstall_hook(send_autojoin_cb, oftc_sendmsg_svsjoin); 196 212 } 197 213 … … 290 306 strlcpy(target->certfp, parv[2], sizeof(target->certfp)); 291 307 execute_callback(on_certfp_cb, target); 308 } 309 310 static void 311 m_auth(struct Client *client, struct Client *source, int parc, char *parv[]) 312 { 313 ilog(L_DEBUG, "AUTH request for %s[%s] certfp %s from %s", parv[1], 314 parv[2], parv[3], parv[0]); 315 316 execute_callback(on_auth_request_cb, parv[1], parv[2], parv[3]); 292 317 } 293 318 … … 663 688 664 689 static void * 690 oftc_sendmsg_svsjoin(va_list args) 691 { 692 struct Client *uplink = va_arg(args, struct Client *); 693 struct Client *user = va_arg(args, struct Client *); 694 char *channel = va_arg(args, char *); 695 696 if(!HasID(user)) 697 sendto_server(uplink, ":%s SVSJOIN %s :%s", me.name, user->name, channel); 698 else 699 sendto_server(uplink, ":%s SVSJOIN %s :%s", me.name, user->id, channel); 700 701 return pass_callback(oftc_svsjoin_hook, uplink, user, channel); 702 } 703 704 static void * 665 705 oftc_chops_notice(va_list args) 666 706 { … … 750 790 return NULL; 751 791 } 792 793 static void* 794 oftc_sendmsg_auth(va_list args) 795 { 796 struct Client *client = va_arg(args, struct Client *); 797 char *user = va_arg(args, char *); 798 char *nick = va_arg(args, char *); 799 int ret = va_arg(args, int); 800 char *reason = va_arg(args, char *); 801 802 sendto_server(client, ":%s AUTH %s %s %d :%s", me.id, user, nick, ret, reason); 803 804 return NULL; 805 } -
trunk/src/interface.c
r1676 r1681 71 71 struct Callback *send_chops_notice_cb; 72 72 struct Callback *send_squit_cb; 73 struct Callback *send_autojoin_cb; 74 struct Callback *send_auth_cb; 73 75 74 76 static BlockHeap *services_heap = NULL; … … 91 93 struct Callback *on_certfp_cb; 92 94 struct Callback *on_db_init_cb; 95 struct Callback *on_auth_request_cb; 93 96 94 97 struct Callback *on_nick_reg_cb; … … 133 136 send_chops_notice_cb = register_callback("Send NOTICE to channel ops", NULL); 134 137 send_squit_cb = register_callback("Send SQUIT Message", NULL); 138 send_autojoin_cb = register_callback("Auto join a user to a channel", NULL); 139 send_auth_cb = register_callback("Send an AUTH response", NULL); 135 140 on_nick_change_cb = register_callback("Propagate NICK", NULL); 136 141 on_join_cb = register_callback("Propagate JOIN", NULL); … … 158 163 on_chan_reg_cb = register_callback("Newly Registered Chan", NULL); 159 164 on_group_reg_cb = register_callback("Newly Registered Group", NULL); 165 on_auth_request_cb = register_callback("Authetication requested", NULL); 160 166 do_event_cb = register_callback("Event Loop Callback", NULL); 161 167 … … 182 188 unregister_callback(send_kill_cb); 183 189 unregister_callback(send_resv_cb); 190 unregister_callback(send_topic_cb); 191 unregister_callback(send_kill_cb); 192 unregister_callback(send_resv_cb); 184 193 unregister_callback(send_unresv_cb); 185 194 unregister_callback(send_newserver_cb); … … 189 198 unregister_callback(send_chops_notice_cb); 190 199 unregister_callback(send_squit_cb); 200 unregister_callback(send_autojoin_cb); 201 unregister_callback(send_auth_cb); 191 202 unregister_callback(on_nick_change_cb); 192 203 unregister_callback(on_join_cb); … … 211 222 unregister_callback(on_chan_reg_cb); 212 223 unregister_callback(on_group_reg_cb); 224 unregister_callback(on_auth_request_cb); 213 225 unregister_callback(do_event_cb); 214 226 … … 370 382 { 371 383 execute_callback(send_privmsg_cb, me.uplink, service->name, channel->chname, text); 384 } 385 386 void 387 send_auth_reply(struct Service *service, char *user, char *nick, int response, char *reason) 388 { 389 execute_callback(send_auth_cb, me.uplink, user, nick, response, reason); 390 391 ilog(L_DEBUG, "Sending auth reply %s %s %d %s", user, nick, response, reason); 372 392 } 373 393
