From 76d88e31114b5cc0f66f90e76eb9c734bbc9bf4b Mon Sep 17 00:00:00 2001 From: runge Date: Sat, 5 May 2007 14:53:21 +0000 Subject: x11vnc: add groups handling for -users mode. --- x11vnc/x11vnc.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) (limited to 'x11vnc/x11vnc.c') diff --git a/x11vnc/x11vnc.c b/x11vnc/x11vnc.c index b8733fc..b9abaf3 100644 --- a/x11vnc/x11vnc.c +++ b/x11vnc/x11vnc.c @@ -963,7 +963,7 @@ static void immediate_switch_user(int argc, char* argv[]) { } } for (i=1; i < argc; i++) { - char *u; + char *u, *q; if (strcmp(argv[i], "-users")) { continue; @@ -979,6 +979,13 @@ static void immediate_switch_user(int argc, char* argv[]) { /* wants an immediate switch: =bob */ u = strdup(argv[i+1]); *u = '+'; + q = strchr(u, '.'); + if (q) { + user2group = (char **) malloc(2*sizeof(char *)); + user2group[0] = strdup(u+1); + user2group[1] = NULL; + *q = '\0'; + } if (strstr(u, "+guess") == u) { fprintf(stderr, "invalid user: %s\n", u+1); exit(1); @@ -2934,6 +2941,47 @@ int main(int argc, char* argv[]) { launch_gui = 0; } + if (users_list && strchr(users_list, '.')) { + char *p, *q, *tmp = (char *) malloc(strlen(users_list)+1); + char *str = strdup(users_list); + int i, n, db = 1; + + tmp[0] = '\0'; + + n = strlen(users_list) + 1; + user2group = (char **) malloc(n * sizeof(char *)); + for (i=0; i