X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=driver%2Fxscreensaver.c;h=0c4f0e9a3330ca3f40d39c9d701838a998aa8ebf;hb=488f2fa8fbdbc77e91a70da2962d73af49e6cace;hp=a560131f4dbad091be9aedb6b708b664733a4cc9;hpb=49f5b54f312fe4ac2e9bc47581a72451bd0e8439;p=xscreensaver diff --git a/driver/xscreensaver.c b/driver/xscreensaver.c index a560131f..0c4f0e9a 100644 --- a/driver/xscreensaver.c +++ b/driver/xscreensaver.c @@ -1,4 +1,4 @@ -/* xscreensaver, Copyright (c) 1991-2006 Jamie Zawinski +/* xscreensaver, Copyright (c) 1991-2007 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -152,6 +152,8 @@ #include #include #include /* for gethostbyname() */ +#include +#include #ifdef HAVE_XMU # ifndef VMS # include @@ -176,6 +178,7 @@ #include "resources.h" #include "visual.h" #include "usleep.h" +#include "auth.h" saver_info *global_si_kludge = 0; /* I hate C so much... */ @@ -1383,6 +1386,7 @@ main (int argc, char **argv) saver_info the_si; saver_info *si = &the_si; saver_preferences *p = &si->prefs; + struct passwd *spasswd; int i; memset(si, 0, sizeof(*si)); @@ -1398,6 +1402,20 @@ main (int argc, char **argv) privileged_initialization (si, &argc, argv); hack_environment (si); + spasswd = getpwuid(getuid()); + if (!spasswd) + { + fprintf(stderr, "Could not figure out who the current user is!\n"); + return 1; + } + + si->user = strdup(spasswd->pw_name ? spasswd->pw_name : "(unknown)"); + +# ifndef NO_LOCKING + si->unlock_cb = gui_auth_conv; + si->auth_finished_cb = auth_finished_cb; +# endif /* !NO_LOCKING */ + shell = connect_to_server (si, &argc, argv); process_command_line (si, &argc, argv); print_banner (si);