Skip to content

Commit

Permalink
bridge: Also prohibit \ in bridge names.
Browse files Browse the repository at this point in the history
This is only necessary for Windows but it's no great loss elsewhere.

Also, document the restriction on bridge names.

Signed-off-by: Ben Pfaff <[email protected]>
Acked-by: Justin Pettit <[email protected]>
  • Loading branch information
blp committed Feb 3, 2016
1 parent 01c7707 commit 3cbe33d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
9 changes: 6 additions & 3 deletions vswitchd/bridge.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Nicira, Inc.
/* Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -1695,9 +1695,12 @@ add_del_bridges(const struct ovsrec_open_vswitch *cfg)
static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
const struct ovsrec_bridge *br_cfg = cfg->bridges[i];

if (strchr(br_cfg->name, '/')) {
if (strchr(br_cfg->name, '/') || strchr(br_cfg->name, '\\')) {
/* Prevent remote ovsdb-server users from accessing arbitrary
* directories, e.g. consider a bridge named "../../../etc/". */
* directories, e.g. consider a bridge named "../../../etc/".
*
* Prohibiting "\" is only necessary on Windows but it's no great
* loss elsewhere. */
VLOG_WARN_RL(&rl, "ignoring bridge with invalid name \"%s\"",
br_cfg->name);
} else if (!shash_add_once(&new_br, br_cfg->name, br_cfg)) {
Expand Down
12 changes: 9 additions & 3 deletions vswitchd/vswitch.xml
Original file line number Diff line number Diff line change
Expand Up @@ -503,9 +503,15 @@

<group title="Core Features">
<column name="name">
Bridge identifier. Should be alphanumeric and no more than about 8
bytes long. Must be unique among the names of ports, interfaces, and
bridges on a host.
<p>
Bridge identifier. Should be alphanumeric and no more than about 8
bytes long. Must be unique among the names of ports, interfaces, and
bridges on a host.
</p>

<p>
Forward and backward slashes are prohibited in bridge names.
</p>
</column>

<column name="ports">
Expand Down

0 comments on commit 3cbe33d

Please sign in to comment.