equal
deleted
inserted
replaced
18 # |
18 # |
19 # CDDL HEADER END |
19 # CDDL HEADER END |
20 # |
20 # |
21 |
21 |
22 # |
22 # |
23 # Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. |
23 # Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. |
24 # |
24 # |
25 |
25 |
26 import socket |
26 import socket |
27 import ssl |
27 import ssl |
28 import getpass |
28 import getpass |
29 import subprocess |
29 import subprocess |
30 import os |
30 import os |
31 import rad.client as rad |
31 import rad.client as rad |
32 import rad.adaptor as adapt |
32 import rad.adaptor as adapt |
|
33 |
|
34 # |
|
35 # Default path for authenticated AF_UNIX socket |
|
36 # |
|
37 _RAD_PATH_AFUNIX_AUTH = "/system/volatile/rad/radsocket" |
33 |
38 |
34 # |
39 # |
35 # Make pipes quack enough like a socket to satisfy RecordMarkingSocket |
40 # Make pipes quack enough like a socket to satisfy RecordMarkingSocket |
36 # |
41 # |
37 class SocketLike(object): |
42 class SocketLike(object): |
112 return rad.RadConnection(SocketLike(p), locale = locale) |
117 return rad.RadConnection(SocketLike(p), locale = locale) |
113 |
118 |
114 # |
119 # |
115 # Connect to the local rad daemon via the standard unix domain socket |
120 # Connect to the local rad daemon via the standard unix domain socket |
116 # |
121 # |
117 def connect_local(path = "/var/run/radsocket", locale = None): |
122 def connect_local(path = _RAD_PATH_AFUNIX_AUTH, locale = None): |
118 s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM); |
123 s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM); |
119 s.connect(path) |
124 s.connect(path) |
120 return rad.RadConnection(s, locale = locale) |
125 return rad.RadConnection(s, locale = locale) |
121 |
126 |
122 # |
127 # |