Request to un-deprecate tevent_loop_allow_nesting()

Brad Hards bradh at frogmouth.net
Sun Nov 21 13:44:00 MST 2010


G'day,

In OpenChange, we use Samba4 for a lot of things, including authentication. We 
recently had a problem where it just died if you used kerberos (didn't affect 
me, since I don't usually set it up, but a user filed a bug report, and I could 
repeat it).

See http://tracker.openchange.org/issues/336 for the details of the problem.

The fix would appear to be to use tevent_loop_allow_nesting(). However that 
isn't accessible unless you define TEVENT_DEPRECATED, and then it produces 
deprecation warnings. The code from tevent.h:

#ifdef TEVENT_DEPRECATED
#ifndef _DEPRECATED_
#if (__GNUC__ >= 3) && (__GNUC_MINOR__ >= 1 )
#define _DEPRECATED_ __attribute__ ((deprecated))
#else
#define _DEPRECATED_
#endif
#endif
void tevent_loop_allow_nesting(struct tevent_context *ev) _DEPRECATED_;
void tevent_loop_set_nesting_hook(struct tevent_context *ev,
                                  tevent_nesting_hook hook,
                                  void *private_data) _DEPRECATED_;
int _tevent_loop_until(struct tevent_context *ev,
                       bool (*finished)(void *private_data),
                       void *private_data,
                       const char *location) _DEPRECATED_;
#define tevent_loop_until(ev, finished, private_data) \
        _tevent_loop_until(ev, finished, private_data, __location__)
#endif

I'd hoped to work around the warning by just setting the flag directly, but of 
course the struct tevent_context is opaque to the user....

I understand that this is a point of some contention within the samba team, 
but I would like to kerberos work, and I would like to have no warnings in 
openchange. I understand that there is no alternative that we can use at this 
time. So I request that tevent_loop_allow_nesting be un-deprecated.

The easiest solution would just be to change it to something like:
void tevent_loop_allow_nesting(struct tevent_context *ev);
void tevent_loop_set_nesting_hook(struct tevent_context *ev,
                                  tevent_nesting_hook hook,
                                  void *private_data);
int _tevent_loop_until(struct tevent_context *ev,
                       bool (*finished)(void *private_data),
                       void *private_data,
                       const char *location);
#define tevent_loop_until(ev, finished, private_data) \
        _tevent_loop_until(ev, finished, private_data, __location__)
(i.e. remove the while deprecation thing).

Another alternative would be another preprocessor #define (perhaps something 
like TEVENT_ALLOW_NESTING) to do:
#ifndef TEVENT_ALLOW_NESTING
#ifndef _DEPRECATED_
#if (__GNUC__ >= 3) && (__GNUC_MINOR__ >= 1 )
#define _DEPRECATED_ __attribute__ ((deprecated))
#else
#define _DEPRECATED_
#endif
#endif
#else
#ifndef _DEPRECATED_
#define _DEPRECATED_
#endif

that is, only emit deprecation warnings if TEVENT_ALLOW_NESTING is not set 
(and we have a gcc that supports it).

I'm open to other suggestions.

For your consideration.

Brad


More information about the samba-technical mailing list