diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-18 20:34:22 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-18 20:34:22 +0000 |
commit | b09bffed6b43262948018dfb0f11890850ddf7c1 (patch) | |
tree | 138696bfcc7ac01070d0e8ecaa1cdf94611a2bd8 /kuser/kuserldap.cpp | |
parent | 6d43944a7130b9d1b4ae3fba37b774aced8612cf (diff) | |
download | tdeadmin-b09bffed6b43262948018dfb0f11890850ddf7c1.tar.gz tdeadmin-b09bffed6b43262948018dfb0f11890850ddf7c1.zip |
TQt4 port kdeadmin
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeadmin@1237416 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kuser/kuserldap.cpp')
-rw-r--r-- | kuser/kuserldap.cpp | 170 |
1 files changed, 85 insertions, 85 deletions
diff --git a/kuser/kuserldap.cpp b/kuser/kuserldap.cpp index 9555cb5..d1d99b0 100644 --- a/kuser/kuserldap.cpp +++ b/kuser/kuserldap.cpp @@ -176,7 +176,7 @@ void KUserLDAP::data( KIO::Job *, const TQByteArray& data ) else if ( name == "shadowflag" ) mUser->setFlag( val.toLong() ); else if ( name == "sambaacctflags" ) { - if ( !val.contains( 'D' ) ) mUser->setDisabled( false ); + if ( !val.tqcontains( 'D' ) ) mUser->setDisabled( false ); } else if ( name == "sambasid" ) mUser->setSID( val ); else if ( name == "sambaprimarygroupsid" ) @@ -307,9 +307,9 @@ void KUserLDAP::createPassword( KU::KUser *user, const TQString &password ) TQByteArray hash(20); sha1_init( &ctx ); - sha1_update( &ctx, (const Q_UINT8*) password.utf8().data(), + sha1_update( &ctx, (const TQ_UINT8*) password.utf8().data(), password.utf8().length() ); - sha1_final( &ctx, (Q_UINT8*) hash.data() ); + sha1_final( &ctx, (TQ_UINT8*) hash.data() ); user->setPwd( "{SHA}" + KCodecs::base64Encode( ( hash ) ) ); break; } @@ -320,8 +320,8 @@ void KUserLDAP::createPassword( KU::KUser *user, const TQString &password ) TQCString pwd = password.utf8() + salt; sha1_init( &ctx ); - sha1_update( &ctx, (const Q_UINT8*) pwd.data(), pwd.length() ); - sha1_final( &ctx, (Q_UINT8*) hash.data() ); + sha1_update( &ctx, (const TQ_UINT8*) pwd.data(), pwd.length() ); + sha1_final( &ctx, (TQ_UINT8*) hash.data() ); memcpy( &(hash.data()[ 20 ]), salt.data(), 4 ); user->setPwd( "{SSHA}" + KCodecs::base64Encode( ( hash ) ) ); break; @@ -329,7 +329,7 @@ void KUserLDAP::createPassword( KU::KUser *user, const TQString &password ) } if ( caps & Cap_Samba ) { - Q_UINT8 hex[33]; + TQ_UINT8 hex[33]; TQByteArray ntlmhash; ntlmhash = KNTLM::ntlmHash( password ); @@ -341,7 +341,7 @@ void KUserLDAP::createPassword( KU::KUser *user, const TQString &password ) hash[6], hash[7], hash[8], hash[9], hash[10], hash[11], hash[12], hash[13], hash[14], hash[15]); - user->setNTPwd( TQString::fromLatin1( (const char*) &hex, 32 ) ); + user->setNTPwd( TQString::tqfromLatin1( (const char*) &hex, 32 ) ); if ( mCfg->lanmanhash() ) { @@ -354,7 +354,7 @@ void KUserLDAP::createPassword( KU::KUser *user, const TQString &password ) hash[6], hash[7], hash[8], hash[9], hash[10], hash[11], hash[12], hash[13], hash[14], hash[15]); - user->setLMPwd( TQString::fromLatin1( (const char*) &hex, 32 ) ); + user->setLMPwd( TQString::tqfromLatin1( (const char*) &hex, 32 ) ); } else { user->setLMPwd( "" ); } @@ -372,11 +372,11 @@ void KUserLDAP::getLDIF( KU::KUser *user, bool mod ) cn = mCfg->ldapcnfullname() ? user->getFullName() : user->getName(); if ( cn.isEmpty() ) cn = user->getName(); - gecos = TQString::fromLatin1("%1,%2,%3,%4") - .arg(user->getFullName()) - .arg(user->getOffice1()) - .arg(user->getOffice2()) - .arg(user->getAddress()); + gecos = TQString::tqfromLatin1("%1,%2,%3,%4") + .tqarg(user->getFullName()) + .tqarg(user->getOffice1()) + .tqarg(user->getOffice2()) + .tqarg(user->getAddress()); samflags = "[U"; samflags += user->getDisabled() ? 'D' : ' '; @@ -399,7 +399,7 @@ void KUserLDAP::getLDIF( KU::KUser *user, bool mod ) ldif += "dn: " + getRDN( user ).utf8() + "," + mUrl.dn().utf8() + "\n"; if ( mod ) { ldif += "changetype: modify\n"; - ldif += "replace: objectClass\n"; + ldif += "tqreplace: objectClass\n"; } if ( caps & Cap_InetOrg ) @@ -416,7 +416,7 @@ void KUserLDAP::getLDIF( KU::KUser *user, bool mod ) if ( ( caps & Cap_Samba ) && ( user->getCaps() & KU::KUser::Cap_Samba ) ) { ldif += "objectClass: sambaSamAccount\n"; } - if ( mod && mObjectClasses.contains( mUser ) ) { + if ( mod && mObjectClasses.tqcontains( mUser ) ) { TQStringList ocs = mObjectClasses[ mUser ]; kdDebug() << user->getName() << " has additional objectclasses: " << ocs.join(",") << endl; TQValueListIterator<TQString> it; @@ -427,61 +427,61 @@ void KUserLDAP::getLDIF( KU::KUser *user, bool mod ) } } - if ( mod ) ldif += "-\nreplace: cn\n"; + if ( mod ) ldif += "-\ntqreplace: cn\n"; ldif += KABC::LDIF::assembleLine( "cn", cn )+"\n"; if ( caps & Cap_InetOrg ) { - if ( mod ) ldif += "-\nreplace: uid\n"; + if ( mod ) ldif += "-\ntqreplace: uid\n"; ldif += KABC::LDIF::assembleLine( "uid", user->getName() ) + "\n"; } else { - if ( mod ) ldif += "-\nreplace: userid\n"; + if ( mod ) ldif += "-\ntqreplace: userid\n"; ldif += KABC::LDIF::assembleLine( "userid", user->getName() ) + "\n"; } if ( mod ) ldif += "-\n"; if ( ( user->getCaps() & KU::KUser::Cap_POSIX ) || ( caps & Cap_InetOrg ) ) { - if ( mod ) ldif += "replace: userpassword\n"; + if ( mod ) ldif += "tqreplace: userpassword\n"; ldif += KABC::LDIF::assembleLine( "userpassword", pwd )+"\n"; if ( mod ) ldif += "-\n"; } if ( user->getCaps() & KU::KUser::Cap_POSIX ) { - if ( mod ) ldif += "replace: uidnumber\n"; + if ( mod ) ldif += "tqreplace: uidnumber\n"; ldif += KABC::LDIF::assembleLine( "uidnumber", TQString::number( user->getUID() ) )+"\n"; - if ( mod ) ldif += "-\nreplace: gidnumber\n"; + if ( mod ) ldif += "-\ntqreplace: gidnumber\n"; ldif += KABC::LDIF::assembleLine( "gidnumber", TQString::number( user->getGID() ) )+"\n"; - if ( mod ) ldif += "-\nreplace: gecos\n"; + if ( mod ) ldif += "-\ntqreplace: gecos\n"; ldif += KABC::LDIF::assembleLine( "gecos", !mCfg->ldapgecos() ? TQCString() : TQCString( gecos.latin1() ) )+"\n"; - if ( mod ) ldif += "-\nreplace: homedirectory\n"; + if ( mod ) ldif += "-\ntqreplace: homedirectory\n"; ldif += KABC::LDIF::assembleLine( "homedirectory", user->getHomeDir() )+"\n"; - if ( mod ) ldif += "-\nreplace: loginshell\n"; + if ( mod ) ldif += "-\ntqreplace: loginshell\n"; ldif += KABC::LDIF::assembleLine( "loginshell", user->getShell() )+"\n"; if ( mod ) ldif += "-\n"; } else { if ( mod ) { - ldif += "replace: uidnumber\n"; - ldif += "-\nreplace: gidnumber\n"; - ldif += "-\nreplace: homedirectory\n"; - ldif += "-\nreplace: loginshell\n"; - ldif += "-\nreplace: gecos\n"; + ldif += "tqreplace: uidnumber\n"; + ldif += "-\ntqreplace: gidnumber\n"; + ldif += "-\ntqreplace: homedirectory\n"; + ldif += "-\ntqreplace: loginshell\n"; + ldif += "-\ntqreplace: gecos\n"; ldif += "-\n"; } } if ( caps & Cap_InetOrg ) { - if ( mod ) ldif += "replace: sn\n"; + if ( mod ) ldif += "tqreplace: sn\n"; ldif += KABC::LDIF::assembleLine( "sn", user->getSurname() ) + "\n"; - if ( mod ) ldif += "-\nreplace: mail\n"; + if ( mod ) ldif += "-\ntqreplace: mail\n"; ldif += KABC::LDIF::assembleLine( "mail", user->getEmail() ) + "\n"; - if ( mod ) ldif += "-\nreplace: displayName\n"; + if ( mod ) ldif += "-\ntqreplace: displayName\n"; ldif += KABC::LDIF::assembleLine( "displayname", user->getFullName() ) + "\n"; - if ( mod ) ldif += "-\nreplace: postaladdress\n"; + if ( mod ) ldif += "-\ntqreplace: postaladdress\n"; ldif += KABC::LDIF::assembleLine( "postaladdress", user->getAddress() ) + "\n"; - if ( mod ) ldif += "-\nreplace: telephoneNumber\n"; + if ( mod ) ldif += "-\ntqreplace: telephoneNumber\n"; ldif += KABC::LDIF::assembleLine( "telephoneNumber", user->getOffice1() ) + "\n"; ldif += KABC::LDIF::assembleLine( "telephoneNumber", user->getOffice2() ) + "\n"; if ( mod ) ldif += "-\n"; @@ -489,63 +489,63 @@ void KUserLDAP::getLDIF( KU::KUser *user, bool mod ) if ( caps & Cap_Samba ) { if ( user->getCaps() & KU::KUser::Cap_Samba ) { - if ( mod ) ldif += "replace: sambadomainname\n"; + if ( mod ) ldif += "tqreplace: sambadomainname\n"; ldif += KABC::LDIF::assembleLine( "sambadomainname", user->getDomain() ) + "\n"; - if ( mod ) ldif += "-\nreplace: sambauserworkstations\n"; + if ( mod ) ldif += "-\ntqreplace: sambauserworkstations\n"; ldif += KABC::LDIF::assembleLine( "sambauserworkstations", user->getWorkstations() ) + "\n"; - if ( mod ) ldif += "-\nreplace: sambahomepath\n"; + if ( mod ) ldif += "-\ntqreplace: sambahomepath\n"; ldif += KABC::LDIF::assembleLine( "sambahomepath", user->getHomePath() ) + "\n"; - if ( mod ) ldif += "-\nreplace: sambahomedrive\n"; + if ( mod ) ldif += "-\ntqreplace: sambahomedrive\n"; ldif += KABC::LDIF::assembleLine( "sambahomedrive", user->getHomeDrive() ) + "\n"; - if ( mod ) ldif += "-\nreplace: sambalogonscript\n"; + if ( mod ) ldif += "-\ntqreplace: sambalogonscript\n"; ldif += KABC::LDIF::assembleLine( "sambalogonscript", user->getLoginScript() ) + "\n"; - if ( mod ) ldif += "-\nreplace: sambaprofilepath\n"; + if ( mod ) ldif += "-\ntqreplace: sambaprofilepath\n"; ldif += KABC::LDIF::assembleLine( "sambaprofilepath", user->getProfilePath() ) + "\n"; - if ( mod ) ldif += "-\nreplace: sambalmpassword\n"; + if ( mod ) ldif += "-\ntqreplace: sambalmpassword\n"; ldif += KABC::LDIF::assembleLine( "sambalmpassword", user->getLMPwd() ) + "\n"; - if ( mod ) ldif += "-\nreplace: sambantpassword\n"; + if ( mod ) ldif += "-\ntqreplace: sambantpassword\n"; ldif += KABC::LDIF::assembleLine( "sambantpassword", user->getNTPwd() ) + "\n"; - if ( mod ) ldif += "-\nreplace: sambasid\n"; + if ( mod ) ldif += "-\ntqreplace: sambasid\n"; ldif += KABC::LDIF::assembleLine( "sambasid", user->getSID().getSID() ) + "\n"; - if ( mod ) ldif += "-\nreplace: sambaacctflags\n"; + if ( mod ) ldif += "-\ntqreplace: sambaacctflags\n"; ldif += KABC::LDIF::assembleLine( "sambaacctflags", samflags ) + "\n"; - if ( mod ) ldif += "-\nreplace: sambaprimarygroupsid\n"; + if ( mod ) ldif += "-\ntqreplace: sambaprimarygroupsid\n"; ldif += KABC::LDIF::assembleLine( "sambaprimarygroupsid", user->getPGSID().getSID() ) + "\n"; - if ( mod ) ldif += "-\nreplace: sambapwdlastset\n"; + if ( mod ) ldif += "-\ntqreplace: sambapwdlastset\n"; ldif += KABC::LDIF::assembleLine( "sambapwdlastset", TQString::number( user->getLastChange() ) ) + "\n"; - if ( mod ) ldif += "-\nreplace: sambakickofftime\n"; + if ( mod ) ldif += "-\ntqreplace: sambakickofftime\n"; if ( user->getExpire() != -1 ) ldif += KABC::LDIF::assembleLine( "sambakickofftime", TQString::number( user->getExpire() ) ) + "\n"; if ( mod ) ldif += "-\n"; } else { if ( mod ) { - ldif += "replace: sambahomepath\n"; - ldif += "-\nreplace: sambahomedrive\n"; - ldif += "-\nreplace: sambalogonscript\n"; - ldif += "-\nreplace: sambaprofilepath\n"; - ldif += "-\nreplace: sambalmpassword\n"; - ldif += "-\nreplace: sambantpassword\n"; - ldif += "-\nreplace: sambasid\n"; - ldif += "-\nreplace: sambaacctflags\n"; - ldif += "-\nreplace: sambaprimarygroupsid\n"; - ldif += "-\nreplace: sambapwdlastset\n"; - ldif += "-\nreplace: sambakickofftime\n"; - ldif += "-\nreplace: sambalogontime\n"; - ldif += "-\nreplace: sambalogofftime\n"; - ldif += "-\nreplace: sambapwdcanchange\n"; - ldif += "-\nreplace: sambapwdmustchange\n"; - ldif += "-\nreplace: sambauserworkstations\n"; - ldif += "-\nreplace: sambadomainname\n"; - ldif += "-\nreplace: sambamungeddial\n"; - ldif += "-\nreplace: sambabadpasswordcount\n"; - ldif += "-\nreplace: sambabadpasswordtime\n"; - ldif += "-\nreplace: sambadomainname\n"; + ldif += "tqreplace: sambahomepath\n"; + ldif += "-\ntqreplace: sambahomedrive\n"; + ldif += "-\ntqreplace: sambalogonscript\n"; + ldif += "-\ntqreplace: sambaprofilepath\n"; + ldif += "-\ntqreplace: sambalmpassword\n"; + ldif += "-\ntqreplace: sambantpassword\n"; + ldif += "-\ntqreplace: sambasid\n"; + ldif += "-\ntqreplace: sambaacctflags\n"; + ldif += "-\ntqreplace: sambaprimarygroupsid\n"; + ldif += "-\ntqreplace: sambapwdlastset\n"; + ldif += "-\ntqreplace: sambakickofftime\n"; + ldif += "-\ntqreplace: sambalogontime\n"; + ldif += "-\ntqreplace: sambalogofftime\n"; + ldif += "-\ntqreplace: sambapwdcanchange\n"; + ldif += "-\ntqreplace: sambapwdmustchange\n"; + ldif += "-\ntqreplace: sambauserworkstations\n"; + ldif += "-\ntqreplace: sambadomainname\n"; + ldif += "-\ntqreplace: sambamungeddial\n"; + ldif += "-\ntqreplace: sambabadpasswordcount\n"; + ldif += "-\ntqreplace: sambabadpasswordtime\n"; + ldif += "-\ntqreplace: sambadomainname\n"; if ( schemaversion > 0 ) { - ldif += "-\nreplace: sambapasswordhistory\n"; - ldif += "-\nreplace: sambalogonhours\n"; + ldif += "-\ntqreplace: sambapasswordhistory\n"; + ldif += "-\ntqreplace: sambalogonhours\n"; } ldif += "-\n"; } @@ -554,37 +554,37 @@ void KUserLDAP::getLDIF( KU::KUser *user, bool mod ) if ( caps & Cap_Shadow ) { if ( user->getCaps() & KU::KUser::Cap_POSIX ) { - if ( mod ) ldif += "replace: shadowlastchange\n"; //sambapwdlastset + if ( mod ) ldif += "tqreplace: shadowlastchange\n"; //sambapwdlastset ldif += KABC::LDIF::assembleLine( "shadowlastchange", TQString::number( timeToDays( user->getLastChange() ) ) ) + "\n"; - if ( mod ) ldif += "-\nreplace: shadowmin\n"; //sambaPwdCanChange + if ( mod ) ldif += "-\ntqreplace: shadowmin\n"; //sambaPwdCanChange ldif += KABC::LDIF::assembleLine( "shadowmin", TQString::number( user->getMin() ) ) + "\n"; - if ( mod ) ldif += "-\nreplace: shadowmax\n"; //sambaPwdMustChange + if ( mod ) ldif += "-\ntqreplace: shadowmax\n"; //sambaPwdMustChange ldif += KABC::LDIF::assembleLine( "shadowmax", TQString::number( user->getMax() ) ) + "\n"; - if ( mod ) ldif += "-\nreplace: shadowwarning\n"; + if ( mod ) ldif += "-\ntqreplace: shadowwarning\n"; ldif += KABC::LDIF::assembleLine( "shadowwarning", TQString::number( user->getWarn() ) ) + "\n"; - if ( mod ) ldif += "-\nreplace: shadowinactive\n"; + if ( mod ) ldif += "-\ntqreplace: shadowinactive\n"; ldif += KABC::LDIF::assembleLine( "shadowinactive", TQString::number( user->getInactive() ) ) + "\n"; - if ( mod ) ldif += "-\nreplace: shadowexpire\n"; //sambaKickoffTime + if ( mod ) ldif += "-\ntqreplace: shadowexpire\n"; //sambaKickoffTime ldif += KABC::LDIF::assembleLine( "shadowexpire", TQString::number( timeToDays( user->getExpire() ) ) ) + "\n"; - if ( mod ) ldif += "-\nreplace: shadowflag\n"; + if ( mod ) ldif += "-\ntqreplace: shadowflag\n"; ldif += KABC::LDIF::assembleLine( "shadowflag", TQString::number( user->getFlag() ) ) + "\n"; if ( mod ) ldif += "-\n"; } else { if ( mod ) { - ldif += "replace: shadowlastchange\n"; - ldif += "-\nreplace: shadowmin\n"; - ldif += "-\nreplace: shadowmax\n"; - ldif += "-\nreplace: shadowwarning\n"; - ldif += "-\nreplace: shadowinactive\n"; - ldif += "-\nreplace: shadowexpire\n"; - ldif += "-\nreplace: shadowflag\n"; + ldif += "tqreplace: shadowlastchange\n"; + ldif += "-\ntqreplace: shadowmin\n"; + ldif += "-\ntqreplace: shadowmax\n"; + ldif += "-\ntqreplace: shadowwarning\n"; + ldif += "-\ntqreplace: shadowinactive\n"; + ldif += "-\ntqreplace: shadowexpire\n"; + ldif += "-\ntqreplace: shadowflag\n"; ldif += "-\n"; } } @@ -630,7 +630,7 @@ void KUserLDAP::putData( KIO::Job *, TQByteArray& data ) if ( mDelUser ) { kdDebug() << "delete ok for: " << mDelUser->getName() << endl; mDelSucc.append( mDelUser ); - if ( mObjectClasses.contains( mDelUser ) ) { + if ( mObjectClasses.tqcontains( mDelUser ) ) { kdDebug() << "deleting additonal objectclasses!" << endl; mObjectClasses.remove( mDelUser ); } |