Hello, I implemented for my company feauture to limit users to use only specified from me services ( imap, pop3, webmail ).
I'm shure that this change is far away from ideal, but this works fine for me. The problem is that I can't make difference between pop3 and pop3-ssl, imap and imap-ssl, webmail and webmail via secure connection. May be someone can tell me how to make this. I add to mysql table 3 additional fields: imap tinyint(1) notnull default 0 pop3 tinyint(1) notnull default 0 webmail tinyint(1) notnull default 0 When I set coresponding field to 1 user is allowed to logon thru this service ( imap, pop3, webmail ). Any comments for bugs in this patch are wellcome. Svetozar Mihailov PS: Please ignore syslog() functions, they was only for check what's going on.
diff -a courier-0.37.3/authlib/authmysql.c courier-0.37.3_z/authlib/authmysql.c 21a22,23 > #include "syslog.h" > 30c32,34 < --- > /* > syslog(LOG_INFO,"Login Service: %s\n", service ); > */ 38c42 < authinfo=auth_mysql_getuserinfo(user); --- > authinfo=auth_mysql_getuserinfo(user,service); 144c148 < authinfo=auth_mysql_getuserinfo(user); --- > authinfo=auth_mysql_getuserinfo(user,service); diff -a courier-0.37.3/authlib/authmysql.h courier-0.37.3_z/authlib/authmysql.h 23c23 < extern struct authmysqluserinfo *auth_mysql_getuserinfo(const char *); --- > extern struct authmysqluserinfo *auth_mysql_getuserinfo(const char *,const char *); diff -a courier-0.37.3/authlib/authmysqllib.c courier-0.37.3_z/authlib/authmysqllib.c 19a20,21 > #include "syslog.h" > 578c580 < struct authmysqluserinfo *auth_mysql_getuserinfo(const char *username) --- > struct authmysqluserinfo *auth_mysql_getuserinfo(const char *username,const char >*service) 599c601 < "SELECT %s, %s, %s, %s, %s, %s, %s, %s, %s FROM %s WHERE %s = \""; --- > "SELECT %s, %s, %s, %s, %s, %s, %s, %s, %s FROM %s WHERE %s = 1 AND %s = \""; 674c676 < querybuf=malloc(sizeof(query) + 100 + strlen(user_table) + strlen(defdomain) --- > querybuf=malloc(sizeof(query) + 150 + strlen(user_table) + >strlen(defdomain) 688c690 < name_field, user_table, login_field); --- > name_field, user_table, service, login_field); 707c709,711 < --- > /* > syslog(LOG_INFO,"MySQL Query: %s\n", querybuf ); > */ diff -a courier-0.37.3/authlib/preauthmysql.c courier-0.37.3_z/authlib/preauthmysql.c 32c32 < authinfo=auth_mysql_getuserinfo(user); --- > authinfo=auth_mysql_getuserinfo(user,service);
