[Samba] RPC: Problem Deleting LDAP-Entries in pdb_ldap.c
Yohann Fourteau
yohann.fourteau at aitb.org
Tue Feb 24 11:30:17 GMT 2004
I'm sorry, I haven't seen the answer .
I give some explaination here.
Selon Andrew Bartlett <abartlet at samba.org>:
> Can we have a few more comments than this? I know Samba doesn't do
> comments well, but I need to understand what's going on here...
Ok I will be my best in the future :)
> Given the warning in the Linux strtok manpage, this worries me...
It's the first time I code in C... But I know very well LDAP :)
I've learnt C long time ago at school. I haven't seen the warning in the man
page, I was looking for a "split" function easy to use.
> > + DEBUG(5,("smbldap_modify: dn => [%s]\n", dn ));
> > +
> > + for (i = 0; attrs[i] != NULL; i++) {
> > + if ( ( attrs[i]->mod_op == LDAP_MOD_DELETE )
> > + && strequal(attrs[i]->mod_type,rdn_attribut) ) {
> > + for (j=0;attrs[i]->mod_values[j] != NULL; j++) {
> > + if (strequal(attrs[i]->mod_values[j],rdn_value))
> We have to watch what character set this is in. We probably need a
> strequal_utf8() (or if this must be the same case, a normal strcmp()
> call... )
Yes, normaly, the dn is in utf8.
> I realise this is 'alright', but it scares me... We really should
> always safe_strcat() with a constant length, into fixed-size buffers
> only. Things like asprintf() would be better, even if we waste a
> (small) amount of ram building the string.
You've right to be scared. I know what I'v done, the idea is correct (I've
tested it in another language) but I'm not a C expert.
I was waiting for that kind of help.
Memory management, strings manipulation, it's not so easy in C :) (than perl,
php, etc).
I learn.
> Apart from that, this patch looks good - you certainly seem to know what
> you are doing. We just need have this patch cleaned up so that others
> can also understand it :-) (And I'm sure somebody will call me on my
> code at some point here...)
Well, I write more comments and I repost the patch with some modification (I
have to learn about talloc...).
--
Yohann F.
More information about the samba-technical
mailing list