+char *Server_Cmd_USERINFO(tClient *Client, char *Args)
+{
+ int uid;
+ char *user = Args;
+ char *space;
+
+ space = strchr(user, ' ');
+ if(space) *space = '\0';
+
+ // Get recipient
+ uid = GetUserID(user);
+ if( uid == -1 ) return strdup("404 Invalid user");
+
+ return mkstr("202 User %s %i user\n", user, GetBalance(uid));
+}
+
+/**
+ * \brief Authenticate a user
+ * \return User ID, or -1 if authentication failed
+ */
+int GetUserAuth(const char *Salt, const char *Username, const uint8_t *ProvidedHash)
+{
+ #if 0
+ uint8_t h[20];
+ int ofs = strlen(Username) + strlen(Salt);
+ char input[ ofs + 40 + 1];
+ char tmp[4 + strlen(Username) + 1]; // uid=%s
+ #endif
+
+ #if HACK_TPG_NOAUTH
+ if( strcmp(Username, "tpg") == 0 )
+ return GetUserID("tpg");
+ #endif
+ #if HACK_ROOT_NOAUTH
+ if( strcmp(Username, "root") == 0 )
+ return GetUserID("root");
+ #endif
+
+ #if 0
+ //
+ strcpy(input, Username);
+ strcpy(input, Salt);
+ // TODO: Get user's SHA-1 hash
+ sprintf(tmp, "uid=%s", Username);
+ ldap_search_s(ld, "", LDAP_SCOPE_BASE, tmp, "userPassword", 0, res);
+
+ sprintf(input+ofs, "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
+ h[ 0], h[ 1], h[ 2], h[ 3], h[ 4], h[ 5], h[ 6], h[ 7], h[ 8], h[ 9],
+ h[10], h[11], h[12], h[13], h[14], h[15], h[16], h[17], h[18], h[19]
+ );
+ // Then create the hash from the provided salt
+ // Compare that with the provided hash
+ #endif
+
+ return -1;
+}
+