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