diff options
author | Matthias Andree <matthias.andree@gmx.de> | 2008-06-28 22:52:07 +0000 |
---|---|---|
committer | Matthias Andree <matthias.andree@gmx.de> | 2008-06-28 22:52:07 +0000 |
commit | 6959a513c2ab16bf8afe693c7031d7cbe3777a5b (patch) | |
tree | 8dd0022de9a1605026dd75ff54bc8ed20e335219 | |
parent | 32ba4dd6d2c432b0aa38edd73a9ec8e625d26b31 (diff) | |
download | fetchmail-6959a513c2ab16bf8afe693c7031d7cbe3777a5b.tar.gz fetchmail-6959a513c2ab16bf8afe693c7031d7cbe3777a5b.tar.bz2 fetchmail-6959a513c2ab16bf8afe693c7031d7cbe3777a5b.zip |
Change CRLF to LF in contrib/delete-later. Reported by Petr Uzel.
svn path=/branches/BRANCH_6-3/; revision=5210
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | contrib/delete-later | 112 |
2 files changed, 57 insertions, 56 deletions
@@ -115,6 +115,7 @@ fetchmail 6.3.9 (not yet released): * Add sslcommonname option (rcfile and commandline) as a way to work around misconfigured upstream SSL servers that use the wrong certificate name. It specifies which CommonName fetchmail expects and logs. (Daniel Richard G.) +* Changed CRLF to LF line endings in contrib/delete-later (reporter: Petr Uzel) # DOCUMENTATION: * Add fetchmail-SA-2007-02.txt and fetchmail-SA-2008-01.txt. diff --git a/contrib/delete-later b/contrib/delete-later index 50c705c9..4db69732 100644 --- a/contrib/delete-later +++ b/contrib/delete-later @@ -1,56 +1,56 @@ -#!/usr/bin/expect -f
-
-# MySQL database connection settings
-set CRDB_host localhost
-set CRDB_DB test
-set CRDB_username root
-set CRDB_password root
-
-# set eiter one to 1 for verbose output
-log_user 0
-set comments 0
-
-package require mysqltcl
-
-# connect to MySQL database
-set handle [::mysql::connect -host $CRDB_host -user $CRDB_username -password $CRDB_password]
-
-# get server/usernames to clean up
-set userlist [::mysql::sel $handle "SELECT UserID, server, username, password, retaindays from $CRDB_DB.fetchmail_user" -flatlist]
-
-# loop through all users in database
-foreach {userid server username password days} $userlist {
- if {$comments==1} { send_user "\r\nWorking on accound #$userid\r\n*******************************\r\n" }
- eval spawn telnet -l fetchmail_cleanup $server 110
- expect "ready"
- send "USER $username\r"
- expect "password"
- send "PASS $password\r"
- expect "OK"
- send "STAT\r"
- expect "+OK "
- expect -re "\[0-9]* "
- set anz $expect_out(0,string)
- if {$comments==1} { send_user "message count: $anz \r\n" }
- set i 0
- while { $i < $anz } {
- incr i
- send "UIDL $i\r"
- expect -re "\\\+OK $i \(.*\)\r"
- set uid $expect_out(1,string)
- ::mysql::exec $handle "insert ignore into $CRDB_DB.fetchmail values ($userid,'$uid',now());"
- set age [::mysql::sel $handle "SELECT DATEDIFF(now(),Fetchdate) from $CRDB_DB.fetchmail where UserID=$userid and UID='$uid'" -list]
- if {$comments==1} { send_user "Message #$i: UID: $uid , age: $age \r\n" }
- if {$age > $days} {
- send "DELE $i\r"
- expect "deleted"
- if {$comments==1} { send_user "Message $i deleted.\r\n" }
- }
- }
- send "quit\r"
- expect "signing off"
- ::mysql::exec $handle "delete from $CRDB_DB.fetchmail where DATEDIFF(now(),Fetchdate)>($days*2) and UserID=$userid;"
-}
-::mysql::close $handle
-exit
-
+#!/usr/bin/expect -f + +# MySQL database connection settings +set CRDB_host localhost +set CRDB_DB test +set CRDB_username root +set CRDB_password root + +# set eiter one to 1 for verbose output +log_user 0 +set comments 0 + +package require mysqltcl + +# connect to MySQL database +set handle [::mysql::connect -host $CRDB_host -user $CRDB_username -password $CRDB_password] + +# get server/usernames to clean up +set userlist [::mysql::sel $handle "SELECT UserID, server, username, password, retaindays from $CRDB_DB.fetchmail_user" -flatlist] + +# loop through all users in database +foreach {userid server username password days} $userlist { + if {$comments==1} { send_user "\r\nWorking on accound #$userid\r\n*******************************\r\n" } + eval spawn telnet -l fetchmail_cleanup $server 110 + expect "ready" + send "USER $username\r" + expect "password" + send "PASS $password\r" + expect "OK" + send "STAT\r" + expect "+OK " + expect -re "\[0-9]* " + set anz $expect_out(0,string) + if {$comments==1} { send_user "message count: $anz \r\n" } + set i 0 + while { $i < $anz } { + incr i + send "UIDL $i\r" + expect -re "\\\+OK $i \(.*\)\r" + set uid $expect_out(1,string) + ::mysql::exec $handle "insert ignore into $CRDB_DB.fetchmail values ($userid,'$uid',now());" + set age [::mysql::sel $handle "SELECT DATEDIFF(now(),Fetchdate) from $CRDB_DB.fetchmail where UserID=$userid and UID='$uid'" -list] + if {$comments==1} { send_user "Message #$i: UID: $uid , age: $age \r\n" } + if {$age > $days} { + send "DELE $i\r" + expect "deleted" + if {$comments==1} { send_user "Message $i deleted.\r\n" } + } + } + send "quit\r" + expect "signing off" + ::mysql::exec $handle "delete from $CRDB_DB.fetchmail where DATEDIFF(now(),Fetchdate)>($days*2) and UserID=$userid;" +} +::mysql::close $handle +exit + |