google / google/nsscache

How to handle spaces in user names?

Open
#53 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
156
Forks
62
Avg merge
1m
Merged PRs (30d)
4

Description

I don't know why my location's LDAP server is giving me user names with spaces, but it causes the update command to fail (at least the first time). Sample debug output (names tweaked for privacy):

```
DEBUG:NssDbShadowHandler:missing: set(['.Rose Rosey', '.Proj Trainer', '.Jim Knuth', '.Jerry Demo', '.Main Supervisors'])
```
#### On the error
- The temp file contents do include strings like `^U^@^ARose Rosey:*:::::::0^@^E^@^A01115^V^@^A`, so it's not being read back properly.
- The cache keys, read back for verification, include items like `.Rose` and `.Proj`, with the second half truncated.
#### Wait a minute

Unix shortnames can't include spaces anyway, right?
#### Proposed Solutions:
1. Ignore names with spaces on verification step.
2. Ignore names with spaces on Write step.

Suggestions welcome. 2 seems like the right thing to do to me.
#### More error text

```
DEBUG:NssDbShadowHandler:Map contains 4982 elems
DEBUG:NssDbShadowHandler:executing makedb: /usr/bin/makedb - /var/lib/misc/nsscache-cache-file-qTfB8O
DEBUG:NssDbShadowHandler:4982 entries written, 4982 keys
DEBUG:NssDbShadowHandler:verification started /var/lib/misc/nsscache-cache-file-qTfB8O
DEBUG:NssDbShadowHandler:4982 written keys, 9964 cache keys
WARNING:NssDbShadowHandler:verify failed: written keys missing from the on-disk cache!
DEBUG:NssDbShadowHandler:missing: set(['.Rose Rosey', '.Proj Trainer', '.Jim Knuth', '.Jerry Demo', '.Main Supervisors'])
DEBUG:NssDbShadowHandler:rolling back, (not) deleting temp cache file '/var/lib/misc/nsscache-cache-file-qTfB8O'
WARNING:NssDbShadowHandler:verification failed, exiting
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.