101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
+
+
+
-
+
|
(loop
(car tail)
(cdr tail)
newresult
(car argtail)
(cdr argtail)))))))))
;;======================================================================
;; M I S C S T R I N G S T U F F
;;======================================================================
;; random string stuff
(define (s:string-downcase str)
(if (string? str)
(string-translate str "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz")
str))
;; (define session:valid-chars "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")
(define session:valid-chars "abcdefghijklmnopqrstuvwxyz0123456789") ;; cookies are case insensitive.
|
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
|
-
+
|
;;
(define (s:crypt-passwd pw s)
(c:crypt pw (or s (c:crypt-gensalt))))
(define (s:password-match? password crypted)
(let* ((salt (substring crypted 0 2))
(pcrypted (s:crypt-passwd password salt)))
(s:log "INFO: pcrypted=" pcrypted " crypted=" crypted)
;; (s:log "INFO: pcrypted=" pcrypted " crypted=" crypted)
(and (string? password)
(string? pcrypted)
(string=? pcrypted crypted))))
;; (read-line (open-input-pipe "echo foo | mkpasswd -S ab -s"))
(define (s:error-page . err)
|