summaryrefslogtreecommitdiff
path: root/lib/tsocket/tsocket_bsd.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2010-04-27 10:41:46 +0200
committerStefan Metzmacher <metze@samba.org>2010-04-27 13:00:24 +0200
commit2436ec2928d1aac0e6fd885ca1b9cdecef8bf89a (patch)
treed1ae1e929ffa2860eae4ba0ec3fb85f8874dfe51 /lib/tsocket/tsocket_bsd.c
parente1596bbf27ee636d8ab47e39eda21c64ef49b671 (diff)
downloadsamba-2436ec2928d1aac0e6fd885ca1b9cdecef8bf89a.tar.gz
samba-2436ec2928d1aac0e6fd885ca1b9cdecef8bf89a.tar.bz2
samba-2436ec2928d1aac0e6fd885ca1b9cdecef8bf89a.zip
lib/tsocket: add tsocket_address_is_unix() function
metze
Diffstat (limited to 'lib/tsocket/tsocket_bsd.c')
-rw-r--r--lib/tsocket/tsocket_bsd.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/tsocket/tsocket_bsd.c b/lib/tsocket/tsocket_bsd.c
index 5adf9214c8..4a8a63e20b 100644
--- a/lib/tsocket/tsocket_bsd.c
+++ b/lib/tsocket/tsocket_bsd.c
@@ -503,6 +503,23 @@ int tsocket_address_inet_set_port(struct tsocket_address *addr,
return 0;
}
+bool tsocket_address_is_unix(const struct tsocket_address *addr)
+{
+ struct tsocket_address_bsd *bsda = talloc_get_type(addr->private_data,
+ struct tsocket_address_bsd);
+
+ if (!bsda) {
+ return false;
+ }
+
+ switch (bsda->u.sa.sa_family) {
+ case AF_UNIX:
+ return true;
+ }
+
+ return false;
+}
+
int _tsocket_address_unix_from_path(TALLOC_CTX *mem_ctx,
const char *path,
struct tsocket_address **_addr,