public static bool search_one(string fn, string user, UserDb.search_cb bob, object obj) { StreamReader streamReader; try { streamReader = new StreamReader(fn); } catch { return(true); } clib.imsg("search_one: reading file {0} and search for [{0}]", (object)fn, (object)user); User info; do { do { string line = streamReader.ReadLine(); if (line != null) { info = UserDb.read_line(line); } else { goto label_8; } }while (info == null || user != "" && !info.user.Contains(user)); clib.imsg("showing user: {0}", (object)info.user); }while (bob(obj, info)); return(false); label_8: streamReader.Close(); return(true); }
public static User lookup(string user) { User user1 = (User)null; user = user.ToLower(); StreamReader streamReader; try { streamReader = new StreamReader(UserDb.fname(user)); } catch { return((User)null); } while (true) { User user2; do { string line = streamReader.ReadLine(); if (line != null) { user2 = UserDb.read_line(line); } else { goto label_6; } }while (user2 == null || user2.user != user); user1 = user2; } label_6: streamReader.Close(); return(user1); }
public static void init(string path) { UserDb.root = path; UserDb.uidfile = UserDb.root + "/uiduser.dat"; UserDb.uid_load(); }
public static bool check(string user, string passwd) { user = user.ToLower(); User user1 = UserDb.lookup(user); return(user1 != null && (user1.passwd == passwd || user == "anonymous" || (SimpleHash.test_hash(passwd, user1.passwd) || UserDb.digest_passwd(user, passwd) == user1.passwd) || UserDb.decode_passwd(user, user1.passwd) == passwd)); }
private static string fname(string user) { return(UserDb.fname(UserDb.hash(user))); }
public static User lookup(string user) { return(UserDb.lookup(user)); }
public static int uid_get(string user) { return(UserDb.uid_get(user)); }
public static string uid_find_user(int uid) { return(UserDb.uid_find_user(uid)); }
public static void search(string user, UserDb.search_cb cb, object obj) { UserDb.search(user, cb, obj); }
public static bool check(string user, string pass, out string reason) { bool flag1 = false; reason = "user doesn't exist or invalid password"; bool flag2 = UserDb.check(user, pass); if (flag2) { User user1 = UserDb.lookup(user); flag1 = user1.isadmin(); switch (user1.info["status"]) { case "pending": reason = "Sorry you must activate using the token from your email first"; return(false); default: string stuff = user1.info["cached"]; if (stuff != null && stuff.Length > 0) { clib.imsg("found cached life of {0}", (object)stuff); if (clib.time() > clib.atoi(stuff)) { clib.imsg("EXPIRED, MAKE HIM CHECK AGAIN age {0} {1}", (object)(clib.time() - clib.atoi(stuff)), (object)stuff); flag2 = false; } } break; } } if (!flag1 && !Vuser.valid_user(user, out reason)) { return(false); } if (!flag2) { string dest = Ini.getstring(En.auth_imap); if (dest.Length > 0) { Imap imap = new Imap(); clib.imsg("auth_imap {0} {1}", (object)user, (object)dest); string result; if (imap.login(dest, 143, "nossl", user, pass, out result)) { NameValueCollection info = new NameValueCollection(); User user1 = UserDb.lookup(user); if (user1 != null && user1.info != null) { info = user1.info; } info.Set("cached", clib.int_to_string(clib.time() + 604800)); clib.imsg("Imap: login worked for that user/pass {0}", (object)user); string reason1; if (!UserDb.add(user, pass, info, "", out reason1)) { clib.imsg("cacheadd: {0}", (object)reason1); } imap.netclose(); flag2 = true; } else { clib.imsg("imap: login failed on remost host {0}", (object)result); } } } return(flag2); }
public static string get_pass(string user) { User user1 = UserDb.lookup(user); return(user1 == null ? "" : UserDb.decode_passwd(user, user1.passwd)); }