[Freeipa-devel] [PATCH] add ethers.byname and ethers.byaddr NIS maps

Martin Kosek mkosek at redhat.com
Thu Apr 26 07:03:41 UTC 2012


On Wed, 2012-04-25 at 11:24 +0200, Jan Cholasta wrote:
> On 24.4.2012 16:57, Nalin Dahyabhai wrote:
> > On Tue, Apr 24, 2012 at 01:02:44PM +0200, Jan Cholasta wrote:
> >> I'm just curious, why you do this:
> >>
> >> default:nis-keys-format: %mregsub("%{macAddress}
> >> %{fqdn}","(..[:\\\|-]..[:\\\|-]..[:\\\|-]..[:\\\|-]..[:\\\|-]..)
> >> (.*)","%1")
> >>
> >> and not simply this:
> >>
> >> default:nis-keys-format: ${macAddress}
> >>
> >> ?
> >
> > Good eye.  It's because of an implementation detail of the server
> > plugin: when computing entries for a NIS map, it has to be able to deal
> > with the list of keys which it computes having a different number of
> > items in it than the list of corresponding values.
> >
> > If an entry has, say, two 'fqdn' values, and three 'macAddress' values,
> > then for keys "%{macAddress}" would produce three values, and for
> > values, "%{fqdn} %{macAddress} would produce six, since it's generating
> > all of the combinations.
> >
> > In that case the plugin, assuming you want to make all six values
> > visible to clients, has to figure out how to match up three keys to six
> > values.  It can repeat the list of keys as the second (or rightmost)
> > variable changes, like this:
> >    key="fqdn1", value="macAddress1 fqdn1"
> >    key="fqdn2", value="macAddress1 fqdn2"
> >    key="fqdn3", value="macAddress1 fqdn3"
> >    key="fqdn1", value="macAddress2 fqdn1"
> >    key="fqdn2", value="macAddress2 fqdn2"
> >    key="fqdn3", value="macAddress2 fqdn3"
> > or it can repeat the list of keys as the first (or leftmost) variable
> > changes, like this:
> >    key="fqdn1", value="macAddress1 fqdn1"
> >    key="fqdn2", value="macAddress2 fqdn1"
> >    key="fqdn3", value="macAddress1 fqdn2"
> >    key="fqdn1", value="macAddress2 fqdn2"
> >    key="fqdn2", value="macAddress1 fqdn3"
> >    key="fqdn3", value="macAddress2 fqdn3"
> > Now, if your key is the second column, that's not what you want.  If
> > it's the first column, the second way actually looks right:
> >    key="macAddress1", value="macAddress1 fqdn1"
> >    key="macAddress2", value="macAddress2 fqdn1"
> >    key="macAddress1", value="macAddress1 fqdn2"
> >    key="macAddress2", value="macAddress2 fqdn2"
> >    key="macAddress1", value="macAddress1 fqdn3"
> >    key="macAddress2", value="macAddress2 fqdn3"
> >
> > The plugin's not smart enough to figure out which way is correct (and at
> > the moment I can't even remember which way I ended up choosing), so the
> > configuration just makes sure that the list of keys starts out at the
> > same length as the list of values, and then uses the regex to strip out
> > the parts we don't want.
> 
> Thanks for the detailed explanation.
> 
> >
> > Revised patch attached.
> >
> > Cheers,
> >
> > Nalin
> 
> ACK.
> 
> Honza
> 

Pushed to master.

Martin




More information about the Freeipa-devel mailing list