diff options
author | Lance Richardson <lrichard@redhat.com> | 2017-05-01 10:13:02 -0400 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2017-05-04 15:18:51 -0700 |
commit | c19ae4ccf9e8e08df31f0eb1dae8ea84aef5afbc (patch) | |
tree | 760b1a99211c73d6cbc8e7ddf789cb8dc43c29dd /lib/stream.c | |
parent | e5fb78af9a3cd14d96947ed11a5a918ba73ceba2 (diff) | |
download | openvswitch-c19ae4ccf9e8e08df31f0eb1dae8ea84aef5afbc.tar.gz |
stream: store stream peer id with stream state
Track authenticated stream peer ID. For SSL connections, the
authenticated ID is the CN (Common Name) field extracted from
the peer's SSL certificate.
Signed-off-by: Lance Richardson <lrichard@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'lib/stream.c')
-rw-r--r-- | lib/stream.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/stream.c b/lib/stream.c index f6ea8496f..5959309c6 100644 --- a/lib/stream.c +++ b/lib/stream.c @@ -278,8 +278,10 @@ stream_close(struct stream *stream) { if (stream != NULL) { char *name = stream->name; + char *peer_id = stream->peer_id; (stream->class->close)(stream); free(name); + free(peer_id); } } @@ -430,6 +432,19 @@ stream_send_wait(struct stream *stream) stream_wait(stream, STREAM_SEND); } +void +stream_set_peer_id(struct stream *stream, const char *peer_id) +{ + free(stream->peer_id); + stream->peer_id = xstrdup(peer_id); +} + +const char * +stream_get_peer_id(const struct stream *stream) +{ + return stream->peer_id; +} + /* Given 'name', a pstream name in the form "TYPE:ARGS", stores the class * named "TYPE" into '*classp' and returns 0. Returns EAFNOSUPPORT and stores * a null pointer into '*classp' if 'name' is in the wrong form or if no such |