summaryrefslogtreecommitdiff
path: root/source4/lib/replace/inet_aton.c
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2008-03-14 08:49:34 +0100
committerMichael Adam <obnox@samba.org>2008-03-14 09:02:36 +0100
commitfe096dd31336639a478a9f05cb3d790c2c31af47 (patch)
tree84f992e480d888d5b0d151a11320f9376325b2d4 /source4/lib/replace/inet_aton.c
parentde9b3af624833be8f5c3520d5ac99fba14b8032f (diff)
downloadsamba-fe096dd31336639a478a9f05cb3d790c2c31af47.tar.gz
samba-fe096dd31336639a478a9f05cb3d790c2c31af47.tar.bz2
samba-fe096dd31336639a478a9f05cb3d790c2c31af47.zip
libreplace: add an inet_aton() function that calls inet_pton().
inet_aton() is even needed inside libreplace, in the implementation of rep_getaddrinfo(). Michael (This used to be commit bcb2f3a880f8da8f9bedb7a8e61d7d7b533f1919)
Diffstat (limited to 'source4/lib/replace/inet_aton.c')
-rw-r--r--source4/lib/replace/inet_aton.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/source4/lib/replace/inet_aton.c b/source4/lib/replace/inet_aton.c
new file mode 100644
index 0000000000..3eb58f000c
--- /dev/null
+++ b/source4/lib/replace/inet_aton.c
@@ -0,0 +1,29 @@
+/*
+ * Unix SMB/CIFS implementation.
+ * replacement functions
+ * Copyright (C) Michael Adam <obnox@samba.org> 2008
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "replace.h"
+#include "system/network.h"
+
+/**
+ * We know that we have inet_pton from earlier libreplace checks.
+ */
+int rep_inet_aton(const char *src, struct in_addr *dst)
+{
+ return (inet_pton(AF_INET, src, dst) > 0) ? 1 : 0;
+}