Skip to content

Commit

Permalink
Define PrivilegesOf implementation on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
etingof committed Jan 29, 2019
1 parent 6b9826f commit e1878ac
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Revision 0.4.7, released XX-02-2019
-----------------------------------

No changes yet
- Fix to define `PrivilegesOf` on Windows

Revision 0.4.6, released 25-01-2019
-----------------------------------
Expand Down
14 changes: 12 additions & 2 deletions snmpsim/daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,17 @@ def daemonize(pidfile):
raise error.SnmpsimError('Windows is not inhabited with daemons!')


def dropPrivileges(uname, gname):
return
class PrivilegesOf(object):
"""Context manager performing nothing on Windows"""

def __init__(self, *args, **kwargs):
pass

def __enter__(self):
pass

def __exit__(self, *args):
pass

else:
import os
Expand Down Expand Up @@ -90,6 +99,7 @@ def atexit_cb():


class PrivilegesOf(object):
"""Context manager executing under reduced privileges"""

def __init__(self, uname, gname, final=False):
self._uname = uname
Expand Down

0 comments on commit e1878ac

Please sign in to comment.