summaryrefslogtreecommitdiffstats
path: root/kuser/kuserfiles.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:25:18 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:25:18 +0000
commitaa3a1ca934bc541bddd3fa136a85f106f7da266e (patch)
tree9ad0b795aed8fa4ac30c2fe0fd1aacb8175714c0 /kuser/kuserfiles.cpp
parentb10cf7066791a2f362495890cd50c984e8025412 (diff)
downloadtdeadmin-aa3a1ca934bc541bddd3fa136a85f106f7da266e.tar.gz
tdeadmin-aa3a1ca934bc541bddd3fa136a85f106f7da266e.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeadmin@1157635 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kuser/kuserfiles.cpp')
-rw-r--r--kuser/kuserfiles.cpp120
1 files changed, 60 insertions, 60 deletions
diff --git a/kuser/kuserfiles.cpp b/kuser/kuserfiles.cpp
index 5c987bc..5ccfe58 100644
--- a/kuser/kuserfiles.cpp
+++ b/kuser/kuserfiles.cpp
@@ -34,8 +34,8 @@
#include <shadow.h>
#endif
-#include <qstring.h>
-#include <qdir.h>
+#include <tqstring.h>
+#include <tqdir.h>
#include "kglobal_.h"
#include "kuserfiles.h"
@@ -93,9 +93,9 @@ bool KUserFiles::loadpwd()
passwd *p;
KU::KUser *tmpKU = 0;
struct stat st;
- QString filename;
- QString passwd_filename;
- QString nispasswd_filename;
+ TQString filename;
+ TQString passwd_filename;
+ TQString nispasswd_filename;
int rc = 0;
int passwd_errno = 0;
int nispasswd_errno = 0;
@@ -126,9 +126,9 @@ bool KUserFiles::loadpwd()
// Start reading passwd file(s)
for(int i = 0; i < MAXFILES; i++) {
- rc = stat(QFile::encodeName(filename), &st);
+ rc = stat(TQFile::encodeName(filename), &st);
if(rc != 0) {
- KMessageBox::error( 0, i18n("Stat call on file %1 failed: %2\nCheck KUser settings.").arg(filename).arg(QString::fromLocal8Bit(strerror(errno))) );
+ KMessageBox::error( 0, i18n("Stat call on file %1 failed: %2\nCheck KUser settings.").arg(filename).arg(TQString::fromLocal8Bit(strerror(errno))) );
if( (processing_file & P_PASSWD) != 0 ) {
passwd_errno = errno;
if(!nispasswd_filename.isEmpty()) {
@@ -150,10 +150,10 @@ bool KUserFiles::loadpwd()
pwd_gid = st.st_gid;
// We are reading our configuration specified passwd file
- QString tmp;
+ TQString tmp;
#ifdef HAVE_FGETPWENT
- FILE *fpwd = fopen(QFile::encodeName(filename), "r");
+ FILE *fpwd = fopen(TQFile::encodeName(filename), "r");
if(fpwd == NULL) {
KMessageBox::error( 0, i18n("Error opening %1 for reading.").arg(filename) );
return FALSE;
@@ -168,18 +168,18 @@ bool KUserFiles::loadpwd()
tmpKU->setCaps( KU::KUser::Cap_POSIX );
tmpKU->setUID(p->pw_uid);
tmpKU->setGID(p->pw_gid);
- tmpKU->setName(QString::fromLocal8Bit(p->pw_name));
- tmp = QString::fromLocal8Bit( p->pw_passwd );
+ tmpKU->setName(TQString::fromLocal8Bit(p->pw_name));
+ tmp = TQString::fromLocal8Bit( p->pw_passwd );
if ( tmp != "x" && tmp != "*" && !tmp.startsWith("!") )
tmpKU->setDisabled( false );
else
tmpKU->setDisabled( true );
if ( tmp.startsWith("!") ) tmp.remove(0, 1);
tmpKU->setPwd( tmp );
- tmpKU->setHomeDir(QString::fromLocal8Bit(p->pw_dir));
- tmpKU->setShell(QString::fromLocal8Bit(p->pw_shell));
+ tmpKU->setHomeDir(TQString::fromLocal8Bit(p->pw_dir));
+ tmpKU->setShell(TQString::fromLocal8Bit(p->pw_shell));
#if defined(__FreeBSD__) || defined(__bsdi__)
- tmpKU->setClass(QString::fromLatin1(p->pw_class));
+ tmpKU->setClass(TQString::fromLatin1(p->pw_class));
tmpKU->setLastChange(p->pw_change);
tmpKU->setExpire(p->pw_expire);
#endif
@@ -220,7 +220,7 @@ bool KUserFiles::loadpwd()
bool KUserFiles::loadsdw()
{
#ifdef HAVE_SHADOW
- QString shadow_file,tmp;
+ TQString shadow_file,tmp;
struct spwd *spw;
KU::KUser *up = NULL;
struct stat st;
@@ -229,7 +229,7 @@ bool KUserFiles::loadsdw()
if ( shadow_file.isEmpty() )
return TRUE;
- stat( QFile::encodeName(shadow_file), &st);
+ stat( TQFile::encodeName(shadow_file), &st);
sdw_mode = st.st_mode & 0666;
sdw_uid = st.st_uid;
sdw_gid = st.st_gid;
@@ -237,7 +237,7 @@ bool KUserFiles::loadsdw()
#ifdef HAVE_FGETSPENT
FILE *f;
kdDebug() << "open shadow file: " << shadow_file << endl;
- if ((f = fopen( QFile::encodeName(shadow_file), "r")) == NULL) {
+ if ((f = fopen( TQFile::encodeName(shadow_file), "r")) == NULL) {
KMessageBox::error( 0, i18n("Error opening %1 for reading.").arg(shadow_file) );
caps &= ~Cap_Shadow;
return TRUE;
@@ -249,12 +249,12 @@ bool KUserFiles::loadsdw()
#endif
kdDebug() << "shadow entry: " << spw->sp_namp << endl;
- if ((up = lookup(QString::fromLocal8Bit(spw->sp_namp))) == NULL) {
- KMessageBox::error( 0, i18n("No /etc/passwd entry for %1.\nEntry will be removed at the next `Save'-operation.").arg(QString::fromLocal8Bit(spw->sp_namp)) );
+ if ((up = lookup(TQString::fromLocal8Bit(spw->sp_namp))) == NULL) {
+ KMessageBox::error( 0, i18n("No /etc/passwd entry for %1.\nEntry will be removed at the next `Save'-operation.").arg(TQString::fromLocal8Bit(spw->sp_namp)) );
continue;
}
- tmp = QString::fromLocal8Bit( spw->sp_pwdp );
+ tmp = TQString::fromLocal8Bit( spw->sp_pwdp );
if ( tmp.startsWith("!!") || tmp == "*" ) {
up->setDisabled( true );
tmp.remove( 0, 2 );
@@ -298,11 +298,11 @@ bool KUserFiles::savepwd()
uid_t minuid = 0;
int nis_users_written = 0;
uid_t tmp_uid = 0;
- QString s;
- QString s1;
- QString tmp, tmp2;
- QString passwd_filename;
- QString nispasswd_filename;
+ TQString s;
+ TQString s1;
+ TQString tmp, tmp2;
+ TQString passwd_filename;
+ TQString nispasswd_filename;
char errors_found = '\0';
@@ -313,10 +313,10 @@ bool KUserFiles::savepwd()
passwd_filename = mCfg->passwdsrc();
nispasswd_filename = mCfg->nispasswdsrc();
- QString new_passwd_filename =
- passwd_filename + QString::fromLatin1(KU_CREATE_EXT);
- QString new_nispasswd_filename =
- nispasswd_filename+QString::fromLatin1(KU_CREATE_EXT);
+ TQString new_passwd_filename =
+ passwd_filename + TQString::fromLatin1(KU_CREATE_EXT);
+ TQString new_nispasswd_filename =
+ nispasswd_filename+TQString::fromLatin1(KU_CREATE_EXT);
if( nispasswd_filename != passwd_filename ) {
minuid = mCfg->nisminuid();
@@ -342,24 +342,24 @@ bool KUserFiles::savepwd()
if(!passwd_filename.isEmpty()) {
if ((passwd_fd =
- fopen(QFile::encodeName(new_passwd_filename),"w")) == NULL)
+ fopen(TQFile::encodeName(new_passwd_filename),"w")) == NULL)
KMessageBox::error( 0, i18n("Error opening %1 for writing.").arg(passwd_filename) );
}
if(!nispasswd_filename.isEmpty() && (nispasswd_filename != passwd_filename)){
if ((nispasswd_fd =
- fopen(QFile::encodeName(new_nispasswd_filename),"w")) == NULL)
+ fopen(TQFile::encodeName(new_nispasswd_filename),"w")) == NULL)
KMessageBox::error( 0, i18n("Error opening %1 for writing.").arg(nispasswd_filename) );
}
- QPtrListIterator<KU::KUser> it( mUsers );
+ TQPtrListIterator<KU::KUser> it( mUsers );
KU::KUser *user;
bool addok = false;
user = (*it);
while (true) {
if ( user == 0 ) {
if ( addok ) break;
- it = QPtrListIterator<KU::KUser> ( mAdd );
+ it = TQPtrListIterator<KU::KUser> ( mAdd );
user = (*it);
addok = true;
if ( user == 0 ) break;
@@ -393,11 +393,11 @@ bool KUserFiles::savepwd()
s =
user->getName() + ":" +
tmp + ":" +
- QString::number( user->getUID() ) + ":" +
- QString::number( user->getGID() ) + ":" +
+ TQString::number( user->getUID() ) + ":" +
+ TQString::number( user->getGID() ) + ":" +
user->getClass() + ":" +
- QString::number( user->getLastChange() ) + ":" +
- QString::number( user->getExpire() ) + ":";
+ TQString::number( user->getLastChange() ) + ":" +
+ TQString::number( user->getExpire() ) + ":";
s1 =
user->getFullName() + "," +
@@ -411,8 +411,8 @@ bool KUserFiles::savepwd()
s =
user->getName() + ":" +
tmp + ":" +
- QString::number( user->getUID() ) + ":" +
- QString::number( user->getGID() ) + ":";
+ TQString::number( user->getUID() ) + ":" +
+ TQString::number( user->getGID() ) + ":";
s1 =
user->getFullName() + "," +
@@ -457,18 +457,18 @@ bool KUserFiles::savepwd()
if(passwd_fd) {
fclose(passwd_fd);
- chmod(QFile::encodeName(new_passwd_filename), pwd_mode);
- chown(QFile::encodeName(new_passwd_filename), pwd_uid, pwd_gid);
- rename(QFile::encodeName(new_passwd_filename),
- QFile::encodeName(passwd_filename));
+ chmod(TQFile::encodeName(new_passwd_filename), pwd_mode);
+ chown(TQFile::encodeName(new_passwd_filename), pwd_uid, pwd_gid);
+ rename(TQFile::encodeName(new_passwd_filename),
+ TQFile::encodeName(passwd_filename));
}
if(nispasswd_fd) {
fclose(nispasswd_fd);
- chmod(QFile::encodeName(new_nispasswd_filename), pwd_mode);
- chown(QFile::encodeName(new_nispasswd_filename), pwd_uid, pwd_gid);
- rename(QFile::encodeName(new_nispasswd_filename),
- QFile::encodeName(nispasswd_filename));
+ chmod(TQFile::encodeName(new_nispasswd_filename), pwd_mode);
+ chown(TQFile::encodeName(new_nispasswd_filename), pwd_uid, pwd_gid);
+ rename(TQFile::encodeName(new_nispasswd_filename),
+ TQFile::encodeName(nispasswd_filename));
}
if( (errors_found & NOMINUID) != 0 ) {
@@ -506,13 +506,13 @@ bool KUserFiles::savesdw()
{
#ifdef HAVE_SHADOW
bool addok = false;
- QString tmp;
+ TQString tmp;
FILE *f;
struct spwd *spwp;
struct spwd s;
KU::KUser *up;
- QString shadow_file = mCfg->shadowsrc();
- QString new_shadow_file = shadow_file+QString::fromLatin1(KU_CREATE_EXT);
+ TQString shadow_file = mCfg->shadowsrc();
+ TQString new_shadow_file = shadow_file+TQString::fromLatin1(KU_CREATE_EXT);
if ( shadow_file.isEmpty() )
return TRUE;
@@ -522,7 +522,7 @@ bool KUserFiles::savesdw()
s_backuped = TRUE;
}
- if ((f = fopen(QFile::encodeName(new_shadow_file), "w")) == NULL) {
+ if ((f = fopen(TQFile::encodeName(new_shadow_file), "w")) == NULL) {
KMessageBox::error( 0, i18n("Error opening %1 for writing.").arg(new_shadow_file) );
return FALSE;
}
@@ -530,13 +530,13 @@ bool KUserFiles::savesdw()
s.sp_namp = (char *)malloc(200);
s.sp_pwdp = (char *)malloc(200);
- QPtrListIterator<KU::KUser> it( mUsers );
+ TQPtrListIterator<KU::KUser> it( mUsers );
up = (*it);
while (true) {
if ( up == 0 ) {
if ( addok ) break;
- it = QPtrListIterator<KU::KUser> ( mAdd );
+ it = TQPtrListIterator<KU::KUser> ( mAdd );
up = (*it);
addok = true;
if ( up == 0 ) break;
@@ -551,7 +551,7 @@ bool KUserFiles::savesdw()
strncpy( s.sp_namp, up->getName().local8Bit(), 200 );
if ( up->getDisabled() )
- strncpy( s.sp_pwdp, QString("!!" + up->getSPwd()).local8Bit(), 200 );
+ strncpy( s.sp_pwdp, TQString("!!" + up->getSPwd()).local8Bit(), 200 );
else
strncpy( s.sp_pwdp, up->getSPwd().local8Bit(), 200 );
@@ -572,10 +572,10 @@ bool KUserFiles::savesdw()
}
fclose(f);
- chmod(QFile::encodeName(new_shadow_file), sdw_mode);
- chown(QFile::encodeName(new_shadow_file), sdw_uid, sdw_gid);
- rename(QFile::encodeName(new_shadow_file),
- QFile::encodeName(shadow_file));
+ chmod(TQFile::encodeName(new_shadow_file), sdw_mode);
+ chown(TQFile::encodeName(new_shadow_file), sdw_uid, sdw_gid);
+ rename(TQFile::encodeName(new_shadow_file),
+ TQFile::encodeName(shadow_file));
free(s.sp_namp);
free(s.sp_pwdp);
@@ -584,11 +584,11 @@ bool KUserFiles::savesdw()
}
-void KUserFiles::createPassword( KU::KUser *user, const QString &password )
+void KUserFiles::createPassword( KU::KUser *user, const TQString &password )
{
if ( caps & Cap_Shadow ) {
user->setSPwd( encryptPass( password, mCfg->md5shadow() ) );
- user->setPwd( QString::fromLatin1("x") );
+ user->setPwd( TQString::fromLatin1("x") );
} else
user->setPwd( encryptPass( password, false ) );
}