|
|
|
@ -54,7 +54,7 @@ KUserLDAP::KUserLDAP(KUserPrefsBase *cfg) : KU::KUsers( cfg )
|
|
|
|
|
mUrl.setExtension( "x-mech", mCfg->ldapsaslmech() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mUrl.setScope(KABC::LDAPUrl::One);
|
|
|
|
|
mUrl.setScope(TDEABC::LDAPUrl::One);
|
|
|
|
|
mUrl.setExtension("x-dir","base");
|
|
|
|
|
|
|
|
|
|
caps = Cap_Passwd | Cap_Disable_POSIX;
|
|
|
|
@ -102,13 +102,13 @@ void KUserLDAP::data( TDEIO::Job *, const TQByteArray& data )
|
|
|
|
|
mParser.endLDIF();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
KABC::LDIF::ParseVal ret;
|
|
|
|
|
TDEABC::LDIF::ParseVal ret;
|
|
|
|
|
TQString name, val;
|
|
|
|
|
TQByteArray value;
|
|
|
|
|
do {
|
|
|
|
|
ret = mParser.nextItem();
|
|
|
|
|
switch ( ret ) {
|
|
|
|
|
case KABC::LDIF::Item:
|
|
|
|
|
case TDEABC::LDIF::Item:
|
|
|
|
|
name = mParser.attr().lower();
|
|
|
|
|
value = mParser.val();
|
|
|
|
|
val = TQString::fromUtf8( value, value.size() );
|
|
|
|
@ -203,7 +203,7 @@ void KUserLDAP::data( TDEIO::Job *, const TQByteArray& data )
|
|
|
|
|
else if ( name == "sambapasswordhistory" || name == "sambalogonhours" )
|
|
|
|
|
schemaversion = 1;
|
|
|
|
|
break;
|
|
|
|
|
case KABC::LDIF::EndEntry: {
|
|
|
|
|
case TDEABC::LDIF::EndEntry: {
|
|
|
|
|
KU::KUser emptyUser, *newUser;
|
|
|
|
|
kdDebug() << "new user: " << mUser->getName() << endl;
|
|
|
|
|
newUser = new KU::KUser( mUser );
|
|
|
|
@ -227,7 +227,7 @@ void KUserLDAP::data( TDEIO::Job *, const TQByteArray& data )
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
} while ( ret != KABC::LDIF::MoreData );
|
|
|
|
|
} while ( ret != TDEABC::LDIF::MoreData );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool KUserLDAP::reload()
|
|
|
|
@ -428,37 +428,37 @@ void KUserLDAP::getLDIF( KU::KUser *user, bool mod )
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( mod ) ldif += "-\nreplace: cn\n";
|
|
|
|
|
ldif += KABC::LDIF::assembleLine( "cn", cn )+"\n";
|
|
|
|
|
ldif += TDEABC::LDIF::assembleLine( "cn", cn )+"\n";
|
|
|
|
|
if ( caps & Cap_InetOrg ) {
|
|
|
|
|
if ( mod ) ldif += "-\nreplace: uid\n";
|
|
|
|
|
ldif += KABC::LDIF::assembleLine( "uid", user->getName() ) + "\n";
|
|
|
|
|
ldif += TDEABC::LDIF::assembleLine( "uid", user->getName() ) + "\n";
|
|
|
|
|
} else {
|
|
|
|
|
if ( mod ) ldif += "-\nreplace: userid\n";
|
|
|
|
|
ldif += KABC::LDIF::assembleLine( "userid", user->getName() ) + "\n";
|
|
|
|
|
ldif += TDEABC::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";
|
|
|
|
|
ldif += KABC::LDIF::assembleLine( "userpassword", pwd )+"\n";
|
|
|
|
|
ldif += TDEABC::LDIF::assembleLine( "userpassword", pwd )+"\n";
|
|
|
|
|
if ( mod ) ldif += "-\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( user->getCaps() & KU::KUser::Cap_POSIX ) {
|
|
|
|
|
if ( mod ) ldif += "replace: uidnumber\n";
|
|
|
|
|
ldif += KABC::LDIF::assembleLine( "uidnumber",
|
|
|
|
|
ldif += TDEABC::LDIF::assembleLine( "uidnumber",
|
|
|
|
|
TQString::number( user->getUID() ) )+"\n";
|
|
|
|
|
if ( mod ) ldif += "-\nreplace: gidnumber\n";
|
|
|
|
|
ldif += KABC::LDIF::assembleLine( "gidnumber",
|
|
|
|
|
ldif += TDEABC::LDIF::assembleLine( "gidnumber",
|
|
|
|
|
TQString::number( user->getGID() ) )+"\n";
|
|
|
|
|
if ( mod ) ldif += "-\nreplace: gecos\n";
|
|
|
|
|
ldif += KABC::LDIF::assembleLine( "gecos", !mCfg->ldapgecos() ? TQCString() :
|
|
|
|
|
ldif += TDEABC::LDIF::assembleLine( "gecos", !mCfg->ldapgecos() ? TQCString() :
|
|
|
|
|
TQCString( gecos.latin1() ) )+"\n";
|
|
|
|
|
if ( mod ) ldif += "-\nreplace: homedirectory\n";
|
|
|
|
|
ldif += KABC::LDIF::assembleLine( "homedirectory",
|
|
|
|
|
ldif += TDEABC::LDIF::assembleLine( "homedirectory",
|
|
|
|
|
user->getHomeDir() )+"\n";
|
|
|
|
|
if ( mod ) ldif += "-\nreplace: loginshell\n";
|
|
|
|
|
ldif += KABC::LDIF::assembleLine( "loginshell",
|
|
|
|
|
ldif += TDEABC::LDIF::assembleLine( "loginshell",
|
|
|
|
|
user->getShell() )+"\n";
|
|
|
|
|
if ( mod ) ldif += "-\n";
|
|
|
|
|
} else {
|
|
|
|
@ -474,50 +474,50 @@ void KUserLDAP::getLDIF( KU::KUser *user, bool mod )
|
|
|
|
|
|
|
|
|
|
if ( caps & Cap_InetOrg ) {
|
|
|
|
|
if ( mod ) ldif += "replace: sn\n";
|
|
|
|
|
ldif += KABC::LDIF::assembleLine( "sn", user->getSurname() ) + "\n";
|
|
|
|
|
ldif += TDEABC::LDIF::assembleLine( "sn", user->getSurname() ) + "\n";
|
|
|
|
|
if ( mod ) ldif += "-\nreplace: mail\n";
|
|
|
|
|
ldif += KABC::LDIF::assembleLine( "mail", user->getEmail() ) + "\n";
|
|
|
|
|
ldif += TDEABC::LDIF::assembleLine( "mail", user->getEmail() ) + "\n";
|
|
|
|
|
if ( mod ) ldif += "-\nreplace: displayName\n";
|
|
|
|
|
ldif += KABC::LDIF::assembleLine( "displayname", user->getFullName() ) + "\n";
|
|
|
|
|
ldif += TDEABC::LDIF::assembleLine( "displayname", user->getFullName() ) + "\n";
|
|
|
|
|
if ( mod ) ldif += "-\nreplace: postaladdress\n";
|
|
|
|
|
ldif += KABC::LDIF::assembleLine( "postaladdress", user->getAddress() ) + "\n";
|
|
|
|
|
ldif += TDEABC::LDIF::assembleLine( "postaladdress", user->getAddress() ) + "\n";
|
|
|
|
|
if ( mod ) ldif += "-\nreplace: telephoneNumber\n";
|
|
|
|
|
ldif += KABC::LDIF::assembleLine( "telephoneNumber", user->getOffice1() ) + "\n";
|
|
|
|
|
ldif += KABC::LDIF::assembleLine( "telephoneNumber", user->getOffice2() ) + "\n";
|
|
|
|
|
ldif += TDEABC::LDIF::assembleLine( "telephoneNumber", user->getOffice1() ) + "\n";
|
|
|
|
|
ldif += TDEABC::LDIF::assembleLine( "telephoneNumber", user->getOffice2() ) + "\n";
|
|
|
|
|
if ( mod ) ldif += "-\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( caps & Cap_Samba ) {
|
|
|
|
|
if ( user->getCaps() & KU::KUser::Cap_Samba ) {
|
|
|
|
|
if ( mod ) ldif += "replace: sambadomainname\n";
|
|
|
|
|
ldif += KABC::LDIF::assembleLine( "sambadomainname", user->getDomain() ) + "\n";
|
|
|
|
|
ldif += TDEABC::LDIF::assembleLine( "sambadomainname", user->getDomain() ) + "\n";
|
|
|
|
|
if ( mod ) ldif += "-\nreplace: sambauserworkstations\n";
|
|
|
|
|
ldif += KABC::LDIF::assembleLine( "sambauserworkstations", user->getWorkstations() ) + "\n";
|
|
|
|
|
ldif += TDEABC::LDIF::assembleLine( "sambauserworkstations", user->getWorkstations() ) + "\n";
|
|
|
|
|
if ( mod ) ldif += "-\nreplace: sambahomepath\n";
|
|
|
|
|
ldif += KABC::LDIF::assembleLine( "sambahomepath", user->getHomePath() ) + "\n";
|
|
|
|
|
ldif += TDEABC::LDIF::assembleLine( "sambahomepath", user->getHomePath() ) + "\n";
|
|
|
|
|
if ( mod ) ldif += "-\nreplace: sambahomedrive\n";
|
|
|
|
|
ldif += KABC::LDIF::assembleLine( "sambahomedrive", user->getHomeDrive() ) + "\n";
|
|
|
|
|
ldif += TDEABC::LDIF::assembleLine( "sambahomedrive", user->getHomeDrive() ) + "\n";
|
|
|
|
|
if ( mod ) ldif += "-\nreplace: sambalogonscript\n";
|
|
|
|
|
ldif += KABC::LDIF::assembleLine( "sambalogonscript", user->getLoginScript() ) + "\n";
|
|
|
|
|
ldif += TDEABC::LDIF::assembleLine( "sambalogonscript", user->getLoginScript() ) + "\n";
|
|
|
|
|
if ( mod ) ldif += "-\nreplace: sambaprofilepath\n";
|
|
|
|
|
ldif += KABC::LDIF::assembleLine( "sambaprofilepath", user->getProfilePath() ) + "\n";
|
|
|
|
|
ldif += TDEABC::LDIF::assembleLine( "sambaprofilepath", user->getProfilePath() ) + "\n";
|
|
|
|
|
if ( mod ) ldif += "-\nreplace: sambalmpassword\n";
|
|
|
|
|
ldif += KABC::LDIF::assembleLine( "sambalmpassword", user->getLMPwd() ) + "\n";
|
|
|
|
|
ldif += TDEABC::LDIF::assembleLine( "sambalmpassword", user->getLMPwd() ) + "\n";
|
|
|
|
|
if ( mod ) ldif += "-\nreplace: sambantpassword\n";
|
|
|
|
|
ldif += KABC::LDIF::assembleLine( "sambantpassword", user->getNTPwd() ) + "\n";
|
|
|
|
|
ldif += TDEABC::LDIF::assembleLine( "sambantpassword", user->getNTPwd() ) + "\n";
|
|
|
|
|
if ( mod ) ldif += "-\nreplace: sambasid\n";
|
|
|
|
|
ldif += KABC::LDIF::assembleLine( "sambasid", user->getSID().getSID() ) + "\n";
|
|
|
|
|
ldif += TDEABC::LDIF::assembleLine( "sambasid", user->getSID().getSID() ) + "\n";
|
|
|
|
|
if ( mod ) ldif += "-\nreplace: sambaacctflags\n";
|
|
|
|
|
ldif += KABC::LDIF::assembleLine( "sambaacctflags", samflags ) + "\n";
|
|
|
|
|
ldif += TDEABC::LDIF::assembleLine( "sambaacctflags", samflags ) + "\n";
|
|
|
|
|
if ( mod ) ldif += "-\nreplace: sambaprimarygroupsid\n";
|
|
|
|
|
ldif += KABC::LDIF::assembleLine( "sambaprimarygroupsid",
|
|
|
|
|
ldif += TDEABC::LDIF::assembleLine( "sambaprimarygroupsid",
|
|
|
|
|
user->getPGSID().getSID() ) + "\n";
|
|
|
|
|
if ( mod ) ldif += "-\nreplace: sambapwdlastset\n";
|
|
|
|
|
ldif += KABC::LDIF::assembleLine( "sambapwdlastset",
|
|
|
|
|
ldif += TDEABC::LDIF::assembleLine( "sambapwdlastset",
|
|
|
|
|
TQString::number( user->getLastChange() ) ) + "\n";
|
|
|
|
|
if ( mod ) ldif += "-\nreplace: sambakickofftime\n";
|
|
|
|
|
if ( user->getExpire() != -1 ) ldif +=
|
|
|
|
|
KABC::LDIF::assembleLine( "sambakickofftime",
|
|
|
|
|
TDEABC::LDIF::assembleLine( "sambakickofftime",
|
|
|
|
|
TQString::number( user->getExpire() ) ) + "\n";
|
|
|
|
|
if ( mod ) ldif += "-\n";
|
|
|
|
|
} else {
|
|
|
|
@ -555,25 +555,25 @@ 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
|
|
|
|
|
ldif += KABC::LDIF::assembleLine( "shadowlastchange",
|
|
|
|
|
ldif += TDEABC::LDIF::assembleLine( "shadowlastchange",
|
|
|
|
|
TQString::number( timeToDays( user->getLastChange() ) ) ) + "\n";
|
|
|
|
|
if ( mod ) ldif += "-\nreplace: shadowmin\n"; //sambaPwdCanChange
|
|
|
|
|
ldif += KABC::LDIF::assembleLine( "shadowmin",
|
|
|
|
|
ldif += TDEABC::LDIF::assembleLine( "shadowmin",
|
|
|
|
|
TQString::number( user->getMin() ) ) + "\n";
|
|
|
|
|
if ( mod ) ldif += "-\nreplace: shadowmax\n"; //sambaPwdMustChange
|
|
|
|
|
ldif += KABC::LDIF::assembleLine( "shadowmax",
|
|
|
|
|
ldif += TDEABC::LDIF::assembleLine( "shadowmax",
|
|
|
|
|
TQString::number( user->getMax() ) ) + "\n";
|
|
|
|
|
if ( mod ) ldif += "-\nreplace: shadowwarning\n";
|
|
|
|
|
ldif += KABC::LDIF::assembleLine( "shadowwarning",
|
|
|
|
|
ldif += TDEABC::LDIF::assembleLine( "shadowwarning",
|
|
|
|
|
TQString::number( user->getWarn() ) ) + "\n";
|
|
|
|
|
if ( mod ) ldif += "-\nreplace: shadowinactive\n";
|
|
|
|
|
ldif += KABC::LDIF::assembleLine( "shadowinactive",
|
|
|
|
|
ldif += TDEABC::LDIF::assembleLine( "shadowinactive",
|
|
|
|
|
TQString::number( user->getInactive() ) ) + "\n";
|
|
|
|
|
if ( mod ) ldif += "-\nreplace: shadowexpire\n"; //sambaKickoffTime
|
|
|
|
|
ldif += KABC::LDIF::assembleLine( "shadowexpire",
|
|
|
|
|
ldif += TDEABC::LDIF::assembleLine( "shadowexpire",
|
|
|
|
|
TQString::number( timeToDays( user->getExpire() ) ) ) + "\n";
|
|
|
|
|
if ( mod ) ldif += "-\nreplace: shadowflag\n";
|
|
|
|
|
ldif += KABC::LDIF::assembleLine( "shadowflag",
|
|
|
|
|
ldif += TDEABC::LDIF::assembleLine( "shadowflag",
|
|
|
|
|
TQString::number( user->getFlag() ) ) + "\n";
|
|
|
|
|
if ( mod ) ldif += "-\n";
|
|
|
|
|
} else {
|
|
|
|
|