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 }
 };


 

번호 제목 글쓴이 날짜 조회 수
57 범인은 공유기... sukhyun 2008.04.25 22574
56 man ftpd.conf sukhyun 2008.04.25 20023
55 [펌] NFS exports and Mac OS X 10.5 Leopard sukhyun 2008.05.04 24250
54 [펌] Putty Proxy 우회하기(터널링) file sukhyun 2008.06.13 31166
53 Zip Test Script ( BASH ) sukhyun 2008.08.21 20567
52 [Script] the number of files (or directories) sukhyun 2008.08.25 19576
51 [Script] MAMP server backup sukhyun 2008.08.25 20468
50 Pure-ftpd sukhyun 2008.08.28 32170
49 Pure-ftpd : Virtual users sukhyun 2008.08.29 23561
48 boot-132 secret sukhyun 2008.08.30 448
47 [펌] An A-Z Index of the Apple OS X command line sukhyun 2008.08.30 25938
46 [Script] Netstat - Bash sukhyun 2008.08.31 21770
45 boot132 (2nd) secret sukhyun 2008.09.27 370
44 [펌] Create & delete user accounts from the command line on Mac OS X sukhyun 2008.10.01 21799
43 [펌] Creating & deleting system service agent accounts on Mac OS X sukhyun 2008.10.01 28182
42 (비밀글) x86osx - 글 백업 secret sukhyun 2008.10.08 302
41 [작성중] 홈 서버 구성 가이드 - 4. 웹서버를 시동해 보자 - MAMP ( MacOSX Apach + MySQL + PHP ) [3] file sukhyun 2008.11.13 47391
40 [작성중] 홈 서버 구성 가이드 - 1. 홈서버 시스템의 선택 [4] sukhyun 2008.11.14 29198
39 [작성중] 홈서버 구성 가이드 - 2. 네트워크 구성과 공유기 설정 file sukhyun 2008.11.15 31261
38 [작성중] 홈서버 구성 가이드 - 5. FTP를 이용한 파일서버 - LukemFTPd / PureFTPd [1] file sukhyun 2008.11.19 24799

사용자 로그인