"Albe Laurenz" <laurenz.a...@wien.gv.at> wrote: > I wrote: > > Following the discussions in > > http://archives.postgresql.org/pgsql-hackers/2009-09/msg01766.php > > and > > http://archives.postgresql.org/pgsql-hackers/2009-10/msg00025.php , > > here are patches for > > > > a) a hook in backend/commands/user.c that allows one to add > > password checking functions > > b) a contrib module that makes use of the hook and > > c) documentation for the contrib module. > > I found a small but embarrassing bug - here is another version.
I've reviewed your patch. The rough approach looks fine, but I have some comments about function declarations and coding style. The hook in core is declared as: typedef int(*check_password_hook_type)(char * const username, char * const password); but result type is actually treated as a boolean. So, it also should declared as bool. Also, the type of arguments should be "const char *". There several comments in contrib/passwordcheck. - We don't need #ifdef PG_MODULE_MAGIC because the module works only on 8.5 or later; PG_MODULE_MAGIC is always defined there. - _PG_fini() is never called in HEAD anymore. Please remove it. - The function declaration of _PG_init() should be _PG_init(void). - isalpha() should be called as isalpha((unsigned char) c) because it could be crashed by multi-byte characters. - "8 characters long" would be better if it is configurable easily. I don't think it is to be a GUC varable, but #define should be used. - The logic in "check if the password contains only letters" should be "check if the password contains both upper-case, lower-case and non-alphabet letters". Passwords like "12345678' are not enough. - Coding style should more follow postgres. For example, posisions of '{', usage of spaces and linebreaks. Regards, --- ITAGAKI Takahiro NTT Open Source Software Center -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers