Hi Holger,
2013/9/18 Holger Hans Peter Freyther holger@freyther.de:
this causes a segfault in the tests (as there is no network that we pass). E.g. make check is failing.
Yes, I missed "make check", I will fix db test to support our case.
On second thought I wonder about the semantic of this patch. E.g. if I run an accept-all network.. and then switch to a closed policy. The authorized field will still be 0. But with this change I can not easily change.
For auth policy clarification: accept-all = accept MS with authorized = 1 and 0, for all new subscribers set authorized = 0 closed = accept MS with authorized = 1, MS with authorized = 0 and all new subscribers should be rejected black-list = accept MS with authorized = 1, MS with authorized = 0 should be rejected, for all new subscribers set authorized = 1
You can see, that "black-list" is like "closed", but in black-list mode we set authorized = 1 for all new subscribers. So the idea was to save meaning of authorized parameter, accept with authorized = 1 and reject with authorized = 0.
Have you considered using an enum like
enum { AUTHORIZED_NOTSET, AUTHORIZED_ALLOWED, AUTHORIZES_BLACKLISTED, };
return subscriber->authorized;return subscriber->authorized != AUTHORIZES_BLACKLISTED?doesn't look too bad and one avoids the using net inside the db code.
What's the problem to use net inside the db code? Moreover, net is used in db_create_subscriber() function.