Chore Account server

Check-in [a1cb0fe2a0]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Make UDS group protection friendly
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256:a1cb0fe2a012ecc008dc342549371da36e33d7031e59856b725f44c7f0fe69ed
User & Date: ajv-899-334-8894@vsta.org 2016-11-30 22:48:55
Context
2018-04-27
03:52
Track chore changes check-in: 105e6cf694 user: vandyswa@gmail.com tags: master, trunk
2016-11-30
22:48
Make UDS group protection friendly check-in: a1cb0fe2a0 user: ajv-899-334-8894@vsta.org tags: master, trunk
20:27
Get server name into title so bookmarks are more descriptive check-in: 6e9e3d2bcf user: ajv-899-334-8894@vsta.org tags: master, trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to main.py.

     1      1   #
     2      2   # account.py
     3      3   #	Manage user accounts across chore services
     4      4   #
     5         -import sys, os, threading, socket, json
            5  +import sys, os, threading, socket, json, grp
     6      6   import chore
     7      7   from get import GET_mixin
     8      8   from post import POST_mixin
     9      9   
    10     10   # Extra chars for service names, beyond isalnum()
    11     11   OkChars = set([' ', '_'])
    12     12   
................................................................................
   271    271           nm = "/tmp/acct-%s" % (dom,)
   272    272           try:
   273    273               # Old instance
   274    274               os.unlink(nm)
   275    275           except:
   276    276               pass
   277    277           s = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM)
   278         -        os.fchmod(s.fileno(), 0660)
   279    278           s.bind(nm)
          279  +        os.chmod(nm, 0660)
          280  +	os.chown(nm,
          281  +	    os.getuid(),
          282  +	    grp.getgrnam(cfg.get("group", "chore")).gr_gid)
   280    283           sys.stderr.write("Account server for %s running\n" % (dom,))
   281    284   
   282    285           # Service loop
   283    286           while True:
   284    287               # Next request
   285    288               buf = s.recv(65536)
   286    289