added check: password stored in NIS passwd?

This commit is contained in:
eknauel 2004-11-09 13:03:09 +00:00
parent c68b9d1ec2
commit 09f27ea9f3
1 changed files with 17 additions and 3 deletions

View File

@ -1,5 +1,5 @@
#!/bin/sh #!/bin/sh
exec scsh -lel expect/load.scm -o threads -o expect -o let-opt -e main -s "$0" "$@" exec scsh -lel expect/load.scm -lel yp/load.scm -o yp -o threads -o expect -o let-opt -e main -s "$0" "$@"
!# !#
;; TODO: ;; TODO:
@ -165,6 +165,16 @@ Please choose a password with at least 2 character classes.")
;; *** interface to yppasswd ***************************************** ;; *** interface to yppasswd *****************************************
(define (password-stored-in-yp-passwd? user . args)
(let-optionals args
((domain (yp-get-default-domain)))
(let ((splitter (infix-splitter (rx ":"))))
(cond
((yp-match "passwd.byname" user domain)
=> (lambda (entry)
(not (string=? "x" (cadr (splitter entry))))))
(else #f)))))
(define yppasswd (define yppasswd
(let ((program "/usr/bin/yppasswd")) (let ((program "/usr/bin/yppasswd"))
(case system-type (case system-type
@ -192,10 +202,14 @@ Please choose a password with at least 2 character classes.")
))))) )))))
(define (verify-yp-password password) (define (verify-yp-password password)
(verify-password yppasswd password)) (if (password-stored-in-yp-passwd? (user-login-name))
(verify-password yppasswd password)
#t))
(define (change-yp-password old-pw new-pw) (define (change-yp-password old-pw new-pw)
(change-password yppasswd old-pw new-pw)) (if (password-stored-in-yp-passwd? (user-login-name))
(change-password yppasswd old-pw new-pw)
#t))
;; *** Kerberos V interface ****************************************** ;; *** Kerberos V interface ******************************************