]> ruderich.org/simon Gitweb - nsscash/nsscash.git/blobdiff - passwd.go
nss: Makefile: fix typo in LD_PRELOAD variable name
[nsscash/nsscash.git] / passwd.go
index c07e9c73914d378d8964756994542f92eeefb3b1..90351900b334b4e9154683eeb437aedff54d0b06 100644 (file)
--- a/passwd.go
+++ b/passwd.go
@@ -137,7 +137,7 @@ func SerializePasswd(p Passwd) []byte {
        l := res.Len()
        if l%8 != 0 {
                for i := 0; i < 8-l%8; i++ {
-                       res.Write([]byte{'0'})
+                       res.WriteByte(0)
                }
        }
 
@@ -191,7 +191,8 @@ func SerializePasswds(w io.Writer, pws []Passwd) error {
        }
 
        // Sanity check
-       if indexOrig.Len() != indexId.Len() ||
+       if len(pws)*8 != indexOrig.Len() ||
+               indexOrig.Len() != indexId.Len() ||
                indexId.Len() != indexName.Len() {
                return fmt.Errorf("indexes have inconsistent length")
        }