Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 746227 | Differences between
and this patch

Collapse All | Expand All

(-)a/unix/vncserver/vncsession.c (-8 / +17 lines)
Lines 413-419 Link Here
413
}
413
}
414
414
415
static pid_t
415
static pid_t
416
run_script(const char *username, const char *display, char **envp)
416
run_script(const char *username, const char *display, const char *xsession, char **envp)
417
{
417
{
418
    struct passwd *pwent;
418
    struct passwd *pwent;
419
    pid_t pid;
419
    pid_t pid;
Lines 472-479 Link Here
472
472
473
    child_argv[0] = CMAKE_INSTALL_FULL_LIBEXECDIR "/vncserver";
473
    child_argv[0] = CMAKE_INSTALL_FULL_LIBEXECDIR "/vncserver";
474
    child_argv[1] = display;
474
    child_argv[1] = display;
475
    child_argv[2] = NULL;
475
    if ( strlen(xsession) > 0 ){
476
476
	    child_argv[2] = xsession;
477
	    child_argv[3] = NULL;
478
    }
479
    else{
480
	    child_argv[2] = NULL;
481
    }
482
    
477
    execvp(child_argv[0], (char*const*)child_argv);
483
    execvp(child_argv[0], (char*const*)child_argv);
478
484
479
    // execvp failed
485
    // execvp failed
Lines 488-503 Link Here
488
    char pid_file[PATH_MAX];
494
    char pid_file[PATH_MAX];
489
    FILE *f;
495
    FILE *f;
490
496
491
    const char *username, *display;
497
    const char *username, *display, *xsession="";
492
498
493
    if ((argc != 3) || (argv[2][0] != ':')) {
499
    if ( ( (argc != 3) && (argc != 4) ) || (argv[2][0] != ':')) {
494
        fprintf(stderr, "Syntax:\n");
500
        fprintf(stderr, "Syntax:\n");
495
        fprintf(stderr, "    %s <username> <display>\n", argv[0]);
501
        fprintf(stderr, "    %s <username> <display> [<xsession-file>]\n", argv[0]);
496
        return EX_USAGE;
502
        return EX_USAGE;
497
    }
503
    }
498
504
499
    username = argv[1];
505
    username = argv[1];
500
    display = argv[2];
506
    display = argv[2];
507
    if (argc == 4 ) {
508
    	xsession = argv[3];
509
    }
501
510
502
    if (geteuid() != 0) {
511
    if (geteuid() != 0) {
503
        fprintf(stderr, "This program needs to be run as root!\n");
512
        fprintf(stderr, "This program needs to be run as root!\n");
Lines 546-553 Link Here
546
    }
555
    }
547
556
548
    setup_signals();
557
    setup_signals();
549
558
    
550
    script = run_script(username, display, child_env);
559
    script = run_script(username, display, xsession, child_env);
551
    if (script == -1) {
560
    if (script == -1) {
552
        syslog(LOG_CRIT, "Failure starting vncserver script");
561
        syslog(LOG_CRIT, "Failure starting vncserver script");
553
        stop_pam(pamh, pamret);
562
        stop_pam(pamh, pamret);

Return to bug 746227