[PC-BSD Commits] r2681 - pcbsd/trunk/PCInstall

svn at pcbsd.org svn at pcbsd.org
Tue Sep 2 12:34:51 PDT 2008


Author: kris
Date: 2008-09-02 12:34:50 -0700 (Tue, 02 Sep 2008)
New Revision: 2681

Modified:
   pcbsd/trunk/PCInstall/pcinstall.cpp
   pcbsd/trunk/PCInstall/pcinstall.ui
Log:

Fixed installer to accept any type of user / root passwords the user wants to install with



Modified: pcbsd/trunk/PCInstall/pcinstall.cpp
===================================================================
--- pcbsd/trunk/PCInstall/pcinstall.cpp	2008-09-02 19:01:50 UTC (rev 2680)
+++ pcbsd/trunk/PCInstall/pcinstall.cpp	2008-09-02 19:34:50 UTC (rev 2681)
@@ -499,12 +499,6 @@
 	ok = 1;
     }
     
-    //Check username password contains only letters and numbers
-    if ((! passwordRegExp.exactMatch(linePassword->text())) && (linePassword->text() != "")) {
-	textAcctNotify->setText(tr("Warning: Root password may normally only use letters and numbers!"));
-	linePassword->setPaletteBackgroundColor(colourRed);
-	ok = 1;
-    }
     if ((linePassword->text() != linePassword2->text()) || linePassword->text().isEmpty())
     {
 	ok = 1;
@@ -1511,12 +1505,23 @@
 	QTextStream userStream( &userList);
 	
 	
+   // Save the root password
+   QFile filePassRoot( "/mnt/tmp/setPass-Root" );
+    if ( filePassRoot.open( IO_WriteOnly ) ) {
+	QTextStream streamPassRoot( &filePassRoot );
+	streamPassRoot << linePassword->text();
+	filePassRoot.close();
+    }
     
-    
+   // Set our variables for the user passwords
+   QFile filePassUser; 
+   QString fileNameUser, tmp;
+
    QFile file( "/mnt/tmp/setPass" );
     if ( file.open( IO_WriteOnly ) ) {
 	QTextStream stream( &file );
-	stream << "echo '" << linePassword->text().replace("\'","\\\'") << "' | pw usermod root -h 0\n" ;
+	stream << "cat /tmp/setPass-Root | pw usermod root -h 0\n" ;
+	stream << "rm /tmp/setPass-Root\n" ;
 	while ( i < 100)
 	{
 	
@@ -1524,8 +1529,19 @@
 	    {
 		break;   
 	    }
+   
+    	    // Save the password text to file
+            fileNameUser = "/mnt/tmp/setPass-User" + tmp.setNum(i);
+   	    filePassUser.setFileName( fileNameUser );
+    	    if ( filePassUser.open( IO_WriteOnly ) ) {
+		QTextStream streamPassUser( &filePassUser );
+		streamPassUser << AddPassword[i];
+                filePassUser.close();
+            }
+    
 		
-	    stream << "echo '" << AddPassword[i].replace("\'","\\\'") << "' | pw useradd -n " << AddUserName[i] << " -G wheel,operator -h 0 -s " + AddShell[i] + " -d /home/" << AddUserName[i] << " -m -c \"" << AddRealName[i] << "\"\n";
+	    stream << "cat /tmp/setPass-User" + tmp.setNum(i) + " | pw useradd -n " << AddUserName[i] << " -G wheel,operator -h 0 -s " + AddShell[i] + " -d /home/" << AddUserName[i] << " -m -c \"" << AddRealName[i] << "\"\n";
+	    stream << "rm /tmp/setPass-User" + tmp.setNum(i) + "\n";
 	
 	    stream << "chown -R " << AddUserName[i] << " /home/" << AddUserName[i] << "\n";
 	    stream << "chgrp -R " << AddUserName[i] << " /home/" << AddUserName[i] << "\n";
@@ -2312,23 +2328,14 @@
     
     
     
-        //Check username contains only letters and numbers
+    //Check username contains only letters and numbers
     if ((! passwordRegExp.exactMatch(lineUserName->text())) && (lineUserName->text() != "")) {
 	textAcctNotify->setText(tr("Username may contain only letters and numbers!"));
 	lineUserName->setPaletteBackgroundColor(colourRed);
 	ok = FALSE;
     }
     
-    //Check password contains only letters and numbers
-    if ((! passwordRegExp.exactMatch(lineUserPassword->text())) && (lineUserPassword->text() != "")) {
-	textAcctNotify->setText(tr("User password may contain only letters and numbers!"));
-	lineUserPassword->setPaletteBackgroundColor(colourRed);
-	ok = FALSE;
-    }
     
-
-    
-    
     if ( (lineUserPassword->text() != lineUserPassword2->text()) || lineUserPassword->text().isEmpty())
     {
 	ok = FALSE;

Modified: pcbsd/trunk/PCInstall/pcinstall.ui
===================================================================
--- pcbsd/trunk/PCInstall/pcinstall.ui	2008-09-02 19:01:50 UTC (rev 2680)
+++ pcbsd/trunk/PCInstall/pcinstall.ui	2008-09-02 19:34:50 UTC (rev 2681)
@@ -28,14 +28,6 @@
    <string>PC-BSD Install</string>
   </property>
   <widget class="QWidget" name="WizardPage" >
-   <property name="geometry" >
-    <rect>
-     <x>6</x>
-     <y>34</y>
-     <width>988</width>
-     <height>651</height>
-    </rect>
-   </property>
    <attribute name="title" >
     <string>Select Language and Keyboard</string>
    </attribute>
@@ -430,7 +422,7 @@
       <font/>
      </property>
      <property name="text" >
-      <string>Version 7-Alpha</string>
+      <string>Version 7</string>
      </property>
      <property name="alignment" >
       <set>Qt::AlignCenter</set>
@@ -5570,6 +5562,14 @@
    </widget>
   </widget>
   <widget class="QWidget" name="WizardPage" >
+   <property name="geometry" >
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>100</width>
+     <height>30</height>
+    </rect>
+   </property>
    <attribute name="title" >
     <string>Installing PC-BSD</string>
    </attribute>



More information about the Commits mailing list