chiark / gitweb /
socket: verify socket type properly when desrializing
[elogind.git] / src / socket-util.c
index 0c9fc9f999e939b1c3fe188ef2b8c51a790433d1..4a1b3d8b515536e97fd0b186ceeed5d8ab276a32 100644 (file)
@@ -443,7 +443,7 @@ bool socket_address_equal(const SocketAddress *a, const SocketAddress *b) {
         return true;
 }
 
-bool socket_address_is(const SocketAddress *a, const char *s) {
+bool socket_address_is(const SocketAddress *a, const char *s, int type) {
         struct SocketAddress b;
 
         assert(a);
@@ -452,6 +452,8 @@ bool socket_address_is(const SocketAddress *a, const char *s) {
         if (socket_address_parse(&b, s) < 0)
                 return false;
 
+        b.type = type;
+
         return socket_address_equal(a, &b);
 }