summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Fulbright <msf@redhat.com>2003-03-31 21:32:45 +0000
committerMike Fulbright <msf@redhat.com>2003-03-31 21:32:45 +0000
commitf69e59fd38cb2b483c8888380bbbaf4034954340 (patch)
tree82bdb67d530ae5bead18dc8d9e349c0c70d5f213
parente34540f1ead7e3eac6cd1dac626d200ee6cf81ab (diff)
downloadanaconda-f69e59fd38cb2b483c8888380bbbaf4034954340.tar.gz
anaconda-f69e59fd38cb2b483c8888380bbbaf4034954340.tar.xz
anaconda-f69e59fd38cb2b483c8888380bbbaf4034954340.zip
some enhancements to vnc mode
-rwxr-xr-xanaconda44
-rw-r--r--loader2/loader.c23
2 files changed, 50 insertions, 17 deletions
diff --git a/anaconda b/anaconda
index 77a30ea7d..2e041fded 100755
--- a/anaconda
+++ b/anaconda
@@ -49,7 +49,7 @@ def startMiniWM(root='/'):
return childpid
# startup vnc X server
-def startVNCServer(vncpasswd=None, root='/'):
+def startVNCServer(vncpassword=None, root='/'):
def set_vnc_password(root, passwd, passwd_file):
(pid, fd) = os.forkpty()
@@ -74,6 +74,14 @@ def startVNCServer(vncpasswd=None, root='/'):
# read remaining output
os.read(fd, 1000)
+ # wait for status
+ try:
+ (pid, status) = os.waitpid(pid, 0)
+ except OSError, (errno, msg):
+ print __name__, "waitpid:", msg
+
+ return status
+
dup_log(_("Starting VNC..."))
vncpid = os.fork()
@@ -83,9 +91,13 @@ def startVNCServer(vncpasswd=None, root='/'):
"-depth", "16", "-geometry", "800x600" "-dontdisconnect"]
# set passwd if necessary
- if vncpasswd is not None:
- set_vnc_password(vncpasswd, "/tmp/vncpasswd_file")
- args = args + ["-rfbauth", "/tmp/vncpasswd_file"]
+ if vncpassword is not None:
+ rc = set_vnc_password(root, vncpassword, "/tmp/vncpasswd_file")
+ if rc:
+ dup_log(_("Unable to set vnc password - using no password!"))
+ dup_log(_("Make sure your password is at least 6 characters in length."))
+ else:
+ args = args + ["-rfbauth", "/tmp/vncpasswd_file"]
tmplogFile = "/tmp/vncserver.log"
try:
@@ -102,7 +114,7 @@ def startVNCServer(vncpasswd=None, root='/'):
os.execv(args[0], args)
sys.exit (1)
- if vncpasswd is None:
+ if vncpassword is None:
dup_log(_("\n\nWARNING!!! VNC server running with NO PASSWORD!"))
dup_log(_("You can use the vncpasswd=<password> boot option"))
dup_log(_("if you would like to secure the server.\n\n"))
@@ -243,7 +255,7 @@ try:
'testpath=', 'mountfs', 'traceonly', 'kickstart=',
'lang=', 'keymap=', 'kbdtype=', 'module=', 'class=',
'expert', 'serial', 'lowres', 'nofb', 'rescue', 'nomount',
- 'autostep', 'resolution=', 'skipddc', 'vnc', 'vncpasswd='])
+ 'autostep', 'resolution=', 'skipddc', 'vnc'])
except TypeError, msg:
sys.stderr.write("Error %s\n:" % msg)
sys.exit(-1)
@@ -307,7 +319,7 @@ progmode = None
customClass = None
kbd = None
ksfile = None
-vncpasswd = None
+vncpassword = None
#
# parse off command line arguments
@@ -377,8 +389,16 @@ for n in args:
kbdtype = arg
elif (str == '--vnc'):
flags.usevnc = 1
- elif (str == '--vncpasswd='):
- vncpasswd = arg
+
+ # see if there is a vnc password file
+ try:
+ pfile = open("/tmp/vncpassword.dat", "r")
+ vncpassword=pfile.readline().strip()
+ pfile.close()
+ os.unlink("/tmp/vncpassword.dat")
+ except:
+ pass
+
# s390s don't have ttys
if iutil.getArch() == "s390":
@@ -630,11 +650,11 @@ else: # s390 checks
# if they want us to use VNC do that now
if display_mode == 'g' and flags.usevnc:
- # dont run vncpasswd if in test mode
+ # dont run vncpassword if in test mode
if flags.test:
- vncpasswd = None
+ vncpassword = None
- startVNCServer(vncpasswd=vncpasswd)
+ startVNCServer(vncpassword=vncpassword)
if display_mode == 'g' and not os.environ.has_key('DISPLAY'):
import rhpl.monitor as monitor
diff --git a/loader2/loader.c b/loader2/loader.c
index 2ed9aa15c..45a0a6222 100644
--- a/loader2/loader.c
+++ b/loader2/loader.c
@@ -359,6 +359,13 @@ static void checkForHardDrives(struct knownDevices * kd, int * flagsPtr) {
return;
}
+static writeVNCPasswordFile(char *pfile, char *password) {
+ FILE *f;
+
+ f = fopen(pfile, "w+");
+ fprintf(f, "%s\n", password);
+ fclose(f);
+}
/* parses /proc/cmdline for any arguments which are important to us.
* NOTE: in test mode, can specify a cmdline with --cmdline
@@ -464,12 +471,18 @@ static int parseCmdLineFlags(int flags, struct loaderData_s * loaderData,
/* the anaconda script, but don't want to represent as a */
/* LOADER_FLAG_XXX since loader doesn't care about these */
/* particular options. */
- if (!strncasecmp(argv[i], "resolution=", 11) ||
+
+ /* do vncpassword case first */
+ logMessage("extra arg = |%s|", argv[i]);
+ logMessage("comparison is %d", strncasecmp(argv[i], "vncpassword=", 12));
+ if (!strncasecmp(argv[i], "vncpassword=", 12)) {
+ if (!FL_TESTING(flags))
+ writeVNCPasswordFile("/tmp/vncpassword.dat", argv[i]+12);
+ } else if (!strncasecmp(argv[i], "resolution=", 11) ||
!strncasecmp(argv[i], "lowres", 6) ||
!strncasecmp(argv[i], "skipddc", 7) ||
!strncasecmp(argv[i], "nomount", 7) ||
- !strncasecmp(argv[i], "vnc", 3) ||
- !strncasecmp(argv[i], "vncpasswd=", 10)) {
+ !strncasecmp(argv[i], "vnc", 3)) {
int arglen;
arglen = strlen(argv[i])+3;
@@ -481,8 +494,8 @@ static int parseCmdLineFlags(int flags, struct loaderData_s * loaderData,
logMessage("Too many command line arguments (max allowed is %s), "
"rest will be dropped.", MAX_EXTRA_ARGS);
}
- }
- }
+ }
+ }
}
/* NULL terminates the array of extra args */