add uid to the thing

This commit is contained in:
Luna Mendes 2017-12-02 12:58:06 -03:00
parent 4704f83e3e
commit 8fce80df33

10
rsudo.c
View file

@ -16,6 +16,7 @@
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/un.h> #include <sys/un.h>
#include <string.h> #include <string.h>
#include <unistd.h>
#include "log.h" #include "log.h"
@ -114,6 +115,15 @@ int main(int argc, char **argv)
if(i != argc - 1) tot = join(tot, " "); if(i != argc - 1) tot = join(tot, " ");
} }
// convert uid to string
int uid = getuid();
char uid_str[6];
sprintf(uid_str, "%d", uid);
tot = join(tot, ",");
tot = join(tot, uid_str);
printf("sending command: %s\n", tot); printf("sending command: %s\n", tot);
// encode our data // encode our data