hide password in log files in opt_password (oset password)
[srvx.git] / src / nickserv.c
index bc507adf659b2be8c7e871ce4c1dbce8e10f2a0c..581d9b47d57ca0c881d6e6d3dca5af0eda1edcce 100644 (file)
@@ -2010,9 +2010,25 @@ reg_allowauth_func(allowauth_func_t func)
     allowauth_func_list[allowauth_func_used++] = func;
 }
 
+static int cmd_authlog_func(struct userNode *user, struct svccmd *cmd, struct handle_info *hi);
+
 static MODCMD_FUNC(cmd_authlog)
 {
-    struct handle_info *hi = user->handle_info;
+    return cmd_authlog_func(user, cmd, user->handle_info);
+}
+
+static MODCMD_FUNC(cmd_oauthlog) {
+    struct handle_info *hi;
+    
+    NICKSERV_MIN_PARMS(1);
+    
+    if (!(hi = get_victim_oper(user, argv[1])))
+        return 0;
+    
+    return cmd_authlog_func(user, cmd, hi);
+}
+
+static int cmd_authlog_func(struct userNode *user, struct svccmd *cmd, struct handle_info *hi) {
     struct helpfile_table tbl;
     struct authlogEntry *authlog;
     int i = 0;
@@ -2797,6 +2813,8 @@ static OPTION_FUNC(opt_password)
         cryptpass(argv[1], hi->passwd);
 
     send_message(user, nickserv, "NSMSG_SET_PASSWORD", "***");
+    argv[1] = "****";
+    
     return 1;
 }
 
@@ -4176,6 +4194,8 @@ nickserv_db_read_authlog(UNUSED_ARG(const char *key), void *data, void *extra)
     str = database_get_data(rd->d.object, KEY_AUTHLOG_QUIT_REASON, RECDB_QSTRING);
     authlog->quit_reason = str ? strdup(str) : NULL;
     
+    authlog->user = NULL;
+    
     authlog->next = NULL;
     
     //append it to the end of the list...
@@ -4911,7 +4931,8 @@ init_nickserv(const char *nick)
     nickserv_define_func("MERGEDB", cmd_mergedb, 999, 1, 0);
     nickserv_define_func("CHECKPASS", cmd_checkpass, 601, 1, 0);
     nickserv_define_func("CHECKEMAIL", cmd_checkemail, 0, 1, 0);
-    nickserv_define_func("AUTHLOG", cmd_authlog, 0, 1, 0);
+    nickserv_define_func("AUTHLOG", cmd_authlog, -1, 1, 0);
+    nickserv_define_func("OAUTHLOG", cmd_oauthlog, 0, 1, 0);
     /* other options */
     dict_insert(nickserv_opt_dict, "INFO", opt_info);
     dict_insert(nickserv_opt_dict, "WIDTH", opt_width);