http://osdir.com/ml/network.pureftpd.user/2005-11/msg00066.html



Mysql-auth per user connection limit feature: msg#00066
network.pureftpd.user

Subject:  Mysql-auth per user connection limit feature

I needed this feature, but haven't found any solution, so i implemented it,
and i saw, that some other people needs it too, so made a patch.
Here it is:
http://dblaci.hu/pure-ftpd/pure-ftpd-1.0.20-mysqlperusermax.patch

I added a comment to the feature request 993994 too.

DBLaci

p.s. i don't know if this mail is going to the right place, if not, sorry.

---------------------------------------------------------------------
To post a new message, e-mail: list@xxxxxxxxxxxx
To unsubscribe, e-mail: list-unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: list-help@xxxxxxxxxxxx



 

diff -ur pure-ftpd-1.0.20.old/pureftpd-mysql.conf pure-ftpd-1.0.20/pureftpd-mysql.conf
--- pure-ftpd-1.0.20.old/pureftpd-mysql.conf 2003-01-21 21:09:44.000000000 +0100
+++ pure-ftpd-1.0.20/pureftpd-mysql.conf 2005-11-18 12:27:34.000000000 +0100
@@ -106,6 +106,12 @@
 # MySQLGetRatioUL SELECT ULRatio FROM users WHERE User="L"
 # MySQLGetRatioDL SELECT DLRatio FROM users WHERE User="L"
 
+# Optional : concurrent session limit per user.
+# The server has to be compiled with per-user-limits support.
+# Value 0 means unlimited. (default)
+
+#MySQLGetPerUserMax SELECT PerUserMax FROM users WHERE User="L"
+
 
 # Optional : bandwidth throttling.
 # The server has to be compiled with throttling support.
diff -ur pure-ftpd-1.0.20.old/src/log_mysql.c pure-ftpd-1.0.20/src/log_mysql.c
--- pure-ftpd-1.0.20.old/src/log_mysql.c 2004-05-15 23:14:06.000000000 +0200
+++ pure-ftpd-1.0.20/src/log_mysql.c 2005-11-18 11:48:58.000000000 +0100
@@ -300,6 +300,9 @@
     const char *bandwidth_ul = NULL;   /* stored bandwidth UL */
     const char *bandwidth_dl = NULL;   /* stored bandwidth DL */
 #endif
+#ifdef PER_USER_LIMITS
+    const char *perusermax = NULL;     /* stored per user concurrent sessions */
+#endif
     char *escaped_account = NULL;
     char *escaped_ip = NULL;
     char *escaped_port = NULL;
@@ -543,6 +546,18 @@
         }
     }
 #endif
+#ifdef PER_USER_LIMITS
+    if ((perusermax = pw_mysql_getquery(id_sql_server, sqlreq_getperusermax,
+                                          escaped_account, escaped_ip,
+                                          escaped_port, escaped_peer_ip,
+                                          escaped_decimal_ip)) != NULL) {
+        const unsigned long q = (unsigned long) strtoul(perusermax, NULL, 10);
+       
+        if (q > 0UL) {
+            result->per_user_max = q;
+        }
+    }
+#endif
     result->slow_tilde_expansion = !tildexp;
     result->auth_ok =- result->auth_ok;
     bye:
@@ -572,6 +587,9 @@
     free((void *) bandwidth_ul);
     free((void *) bandwidth_dl);
 #endif   
+#ifdef PER_USER_LIMITS
+    free((void *) perusermax);
+#endif   
     free((void *) escaped_account);
     free((void *) escaped_ip);
     free((void *) escaped_port);
diff -ur pure-ftpd-1.0.20.old/src/log_mysql_p.h pure-ftpd-1.0.20/src/log_mysql_p.h
--- pure-ftpd-1.0.20.old/src/log_mysql_p.h 2004-02-29 22:49:28.000000000 +0100
+++ pure-ftpd-1.0.20/src/log_mysql_p.h 2005-11-18 11:21:18.000000000 +0100
@@ -38,6 +38,9 @@
 static char *sqlreq_getbandwidth_ul;
 static char *sqlreq_getbandwidth_dl;
 #endif
+#ifdef PER_USER_LIMITS
+static char *sqlreq_getperusermax;
+#endif
 static signed char server_down;
 
 static ConfigKeywords mysql_config_keywords[] = {
@@ -68,6 +71,9 @@
     { "MYSQLGetBandwidthUL", &sqlreq_getbandwidth_ul },
     { "MYSQLGetBandwidthDL", &sqlreq_getbandwidth_dl },
 #endif
+#ifdef PER_USER_LIMITS
+    { "MYSQLGetPerUserMax", &sqlreq_getperusermax },
+#endif
     { NULL, NULL }
 };


 

번호 제목 글쓴이 날짜 조회 수
77 mounting a linux nfs server on mac os x 10.6 [17712] Shadow 2011.02.15 758649
76 MacOSX에 ufraw를 설치하자~ [1] [886] file Shadow 2009.01.03 635902
75 Winclone 부트캠프 백업/복원 어플입니다 [3] [10660] guriii 2009.08.28 394669
74 Carbon Copy Cloner [14197] Shadow 2009.05.04 382783
73 맥북에어 2013 - VMware Fusion 5.x 사용시 화면 깜빡임 해결 방법 [13380] Shadow 2013.07.19 336515
72 screen saver [9091] file Shadow 2013.08.21 307220
71 freetype [1] [10007] Shadow 2009.04.29 277427
70 MacBookAir 11" 2013-mid 256GB SSD 성능 [10865] file Shadow 2013.07.27 276425
69 Chrome Extentions (Bookmarks Menu) Scroll Bar Bug Fix [4367] file Shadow 2013.01.02 232772
68 맥이 아닌 machine에서 맥에 SSH 접속시 한글 표시법 [9665] Shadow 2009.02.10 231109
67 Macbook Air 11inch 128GB SSD performance [11906] file Shadow 2010.11.28 226910
66 eXtplorer 2.0.1 한글 패치 (on MacOSX 다운로드, 표시) 버전 [2] [8710] file Shadow 2010.04.30 210173
65 디스크에 문제가 발생했을 때 [10406] Shadow 2010.12.30 204032
64 file managers based on x11 (supported by MacPorts) [1] [8166] Shadow 2010.02.16 203448
63 gpac (mp4box) [10595] Shadow 2009.04.29 201135
62 MacOSX 10.7 Lion - TRIM 지원 [7] [1402] file Shadow 2011.07.06 170974
61 remote X11forwarding from OSX to Windows [6277] Shadow 2009.01.03 151122
60 rar [823] Shadow 2009.04.29 145304
59 PureFTPd Update! (1.0.22) [7169] Shadow 2009.04.29 144413
» [펌] PureFtpd - Mysql-auth per user connection limit feature [6633] Shadow 2009.02.25 136872

사용자 로그인