|
|
@@ -190,6 +190,40 @@ static struct klist_node *find_user(int fd) {
|
|
|
}
|
|
|
|
|
|
|
|
|
+int get_user_info(int fd, struct vcc_request *req) {
|
|
|
+ struct vcc_request *out;
|
|
|
+ struct user *u;
|
|
|
+
|
|
|
+ if (unlikely(!(out = amalloc(sizeof(struct vcc_request))))) {
|
|
|
+ vcc_log("*** malloc() failed\n");
|
|
|
+
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ out->magic = htonl(VCC_MAGIC);
|
|
|
+ out->reqtype = htonl(REQ_CTL_UINFO);
|
|
|
+ u = (struct user *) out->msg;
|
|
|
+
|
|
|
+ if (get_user(req->msg, u) == -1)
|
|
|
+ out->uid = htonl(-1);
|
|
|
+
|
|
|
+ else {
|
|
|
+ out->uid = 0;
|
|
|
+
|
|
|
+ u->score = htonl(u->score);
|
|
|
+ u->level = htonl(u->level);
|
|
|
+ }
|
|
|
+
|
|
|
+ memset(((struct user *) out->msg)->passwd, 0, PASSWD_SIZE);
|
|
|
+
|
|
|
+ vcc_send_req(find_connection(fd), out);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
int do_user_logout(int fd) {
|
|
|
struct klist_node *n;
|
|
|
struct user *usr;
|