Mailinglist Archive: yast-devel (73 mails)

< Previous Next >
Re: [yast-devel] announce: API changes in yast2-users and yast2-ldap
  • From: Jiří Suchomel <jsuchome@xxxxxxx>
  • Date: Mon, 4 Aug 2008 14:22:06 +0200
  • Message-id: <200808041422.06658.jsuchome@xxxxxxx>
Hi Michael,
I found that yast2-kerberos-server also uses .ldap.search. Please apply the
attached diff and if you find a time, test the new version (with
yast2-ldap-2.17.1)

Jiri

On út 22. července 2008, Jiří Suchomel wrote:
Hi hackers,
those of you who are using neither .ldap agent nor any yast2-users API may
hit Delete now.

For others, I would like to announce that .ldap agent now uses original
LDAP names of the object keys that are returned as a result of a search.
For example, the search for user object which returned
$[
"uidnumber" : 1000,
"homedirectory" : "/home/hh",
"uid" : "hh"
]
now returns
$[
"uidNumber" : 1000,
"homeDirectory" : "/home/hh",
"uid" : "hh"
]

This change (required by feature 303596) affects the return value of
all .ldap.search calls, so please check your code. I tried to grep for
agent usage and update yast2-mail, yast2-ldap-server and
yast2-samba-server, see the attached diff. Please review, or at least test
it and submit the changes.

The change also affects the API of yast2-users, since the module uses for
its internal user and group representation the same keys as are defined for
LDAP. So if you are using the keys directly, e.g. you are changing user
name in this way:

Users::SelectUser (1000);
Users::EditUser ($[ "uidnumber" : 1111 ]);
Users::CommitUser () etc.

you have to change the line where the internal key is used, i.e.
Users::EditUser ($[ "uidNumber" : 1111 ]);

(However, I haven't find anyone using yast2-users module to add or edit
users)

If anything is not clear enough, please ask.

Jiri



--
Jiri Suchomel

SUSE LINUX, s.r.o. e-mail: jsuchome@xxxxxxx
Lihovarská 1060/12 tel: +420 284 028 960
190 00 Praha 9, Czech Republic http://www.suse.cz
Index: src/KerberosServer.pm
===================================================================
--- src/KerberosServer.pm (revision 49555)
+++ src/KerberosServer.pm (working copy)
@@ -1260,7 +1260,7 @@
$ldapbasedn eq "")
{
$ldapbasedn = "dc=".join(",dc=", split(/\./, $domain));
- $ldapdb->{ldap_kerberos_container_dn} = "cn=krbcontainer,".$ldapbasedn;
+ $ldapdb->{ldap_kerberos_container_dn} = "cn=krbContainer,".$ldapbasedn;
$ldapdb->{ldap_kdc_dn} = "cn=Administrator,".$ldapbasedn;
$ldapdb->{ldap_kadmind_dn} = "cn=Administrator,".$ldapbasedn;
}
@@ -1299,7 +1299,7 @@

if(!exists $ldapdb->{ldap_kerberos_container_dn})
{
- $ldapdb->{ldap_kerberos_container_dn} =
"cn=krbcontainer,".$ldapbasedn;
+ $ldapdb->{ldap_kerberos_container_dn} =
"cn=krbContainer,".$ldapbasedn;
}

if(!exists $ldapdb->{ldap_kdc_dn})
@@ -1438,7 +1438,7 @@

my $attr = SCR->Read(".ldap.search", {
"base_dn" =>
$ldapdb->{ldap_kerberos_container_dn},
- "filter" => "(&
(objectclass=krbRealmContainer)(objectclass=krbTicketPolicyAux)(cn=$dbrealm))",
+ "filter" => "(&
(objectClass=krbRealmContainer)(objectClass=krbTicketPolicyAux)(cn=$dbrealm))",
"scope" => 2,
"attrs" => [ "krbSubTrees",
"krbSearchScope", "krbPrincContainerRef",
"krbMaxRenewableAge",
"krbMaxTicketLife", "krbTicketFlags"]
@@ -1466,14 +1466,14 @@
return 1;
}

- if(exists $attributes->{krbsubtrees} && defined $attributes->{krbsubtrees})
+ if(exists $attributes->{krbSubTrees} && defined $attributes->{krbSubTrees})
{
- $kdbvalues->{kdb_subtrees} = join(":", @{$attributes->{krbsubtrees}});
+ $kdbvalues->{kdb_subtrees} = join(":", @{$attributes->{krbSubTrees}});
}
- if(exists $attributes->{krbsearchscope} && defined
$attributes->{krbsearchscope} &&
- exists $attributes->{krbsearchscope}->[0] && defined
$attributes->{krbsearchscope}->[0])
+ if(exists $attributes->{krbSearchScope} && defined
$attributes->{krbSearchScope} &&
+ exists $attributes->{krbSearchScope}->[0] && defined
$attributes->{krbSearchScope}->[0])
{
- if($attributes->{krbsearchscope}->[0] eq "1")
+ if($attributes->{krbSearchScope}->[0] eq "1")
{
$kdbvalues->{kdb_sscope} = "one";
}
@@ -1482,17 +1482,17 @@
$kdbvalues->{kdb_sscope} = "sub";
}
}
- if(exists $attributes->{krbprinccontainerref} && defined
$attributes->{krbprinccontainerref} &&
- exists $attributes->{krbprinccontainerref}->[0] && defined
$attributes->{krbprinccontainerref} &&
- $attributes->{krbprinccontainerref} ne "")
+ if(exists $attributes->{krbPrincContainerRef} && defined
$attributes->{krbPrincContainerRef} &&
+ exists $attributes->{krbPrincContainerRef}->[0] && defined
$attributes->{krbPrincContainerRef} &&
+ $attributes->{krbPrincContainerRef} ne "")
{
- $kdbvalues->{kdb_containerref} = $attributes->{krbprinccontainerref};
+ $kdbvalues->{kdb_containerref} = $attributes->{krbPrincContainerRef};
}
- if(exists $attributes->{krbmaxrenewableage} && defined
$attributes->{krbmaxrenewableage} &&
- exists $attributes->{krbmaxrenewableage}->[0] && defined
$attributes->{krbmaxrenewableage}->[0] &&
- $attributes->{krbmaxrenewableage}->[0] ne "")
+ if(exists $attributes->{krbMaxRenewableAge} && defined
$attributes->{krbMaxRenewableAge} &&
+ exists $attributes->{krbMaxRenewableAge}->[0] && defined
$attributes->{krbMaxRenewableAge}->[0] &&
+ $attributes->{krbMaxRenewableAge}->[0] ne "")
{
- my $dur = $attributes->{krbmaxrenewableage}->[0];
+ my $dur = $attributes->{krbMaxRenewableAge}->[0];

my ($sec,$min,$hour,$days);

@@ -1507,11 +1507,11 @@

$kdbvalues->{kdb_maxrenewlife} = sprintf("%d %02d:%02d:%02d", $days,
$hour, $min, $sec);
}
- if(exists $attributes->{krbmaxticketlife} && defined
$attributes->{krbmaxticketlife} &&
- exists $attributes->{krbmaxticketlife}->[0] && defined
$attributes->{krbmaxticketlife}->[0] &&
- $attributes->{krbmaxticketlife}->[0] ne "")
+ if(exists $attributes->{krbMaxTicketLife} && defined
$attributes->{krbMaxTicketLife} &&
+ exists $attributes->{krbMaxTicketLife}->[0] && defined
$attributes->{krbMaxTicketLife}->[0] &&
+ $attributes->{krbMaxTicketLife}->[0] ne "")
{
- my $dur = $attributes->{krbmaxticketlife}->[0];
+ my $dur = $attributes->{krbMaxTicketLife}->[0];
my ($sec,$min,$hour,$days);

$days = int($dur / (60*60*24));
@@ -1525,11 +1525,11 @@

$kdbvalues->{kdb_maxtktlife} = sprintf("%d %02d:%02d:%02d", $days,
$hour, $min, $sec);
}
- if(exists $attributes->{krbticketflags} && defined
$attributes->{krbticketflags} &&
- exists $attributes->{krbticketflags}->[0] && defined
$attributes->{krbticketflags}->[0] &&
- $attributes->{krbticketflags}->[0] ne "")
+ if(exists $attributes->{krbTicketFlags} && defined
$attributes->{krbTicketFlags} &&
+ exists $attributes->{krbTicketFlags}->[0] && defined
$attributes->{krbTicketFlags}->[0] &&
+ $attributes->{krbTicketFlags}->[0] ne "")
{
- my $flags = $attributes->{krbticketflags}->[0];
+ my $flags = $attributes->{krbTicketFlags}->[0];

$kdbvalues->{kdb_flags} = $class->num2flags($flags);
}
@@ -2002,7 +2002,7 @@
{
my $DNs = SCR->Read(".ldap.search", {
"base_dn" =>
$ldapdb->{ldap_kerberos_container_dn},
- "filter" => "(&
(objectclass=krbRealmContainer)(objectclass=krbTicketPolicyAux)(cn=$dbrealm)($attribute=*))",
+ "filter" => "(&
(objectClass=krbRealmContainer)(objectClass=krbTicketPolicyAux)(cn=$dbrealm)($attribute=*))",
"scope" => 2,
"attrs" => [$attribute],
"dn_only" => 1
< Previous Next >
This Thread
  • No further messages