Merge "services/identityd: Bugfix"
diff --git a/lib/modules/core/mounttable.go b/lib/modules/core/mounttable.go
index 00acb04..9ea0084 100644
--- a/lib/modules/core/mounttable.go
+++ b/lib/modules/core/mounttable.go
@@ -1,6 +1,7 @@
 package core
 
 import (
+	"flag"
 	"fmt"
 	"io"
 	"os"
@@ -13,7 +14,11 @@
 	mounttable "v.io/core/veyron/services/mounttable/lib"
 )
 
+var details *bool
+
 func init() {
+	details = flag.CommandLine.Bool("l", false, "use a long listing format for ls")
+
 	modules.RegisterChild(RootMTCommand, "", rootMountTable)
 	modules.RegisterChild(MTCommand, `<mount point>
 	reads NAMESPACE_ROOT from its environment and mounts a new mount table at <mount point>`, mountTable)
@@ -46,9 +51,9 @@
 		}
 		mp = args[0]
 	}
-	mt, err := mounttable.NewMountTable("")
+	mt, err := mounttable.NewMountTableDispatcher("")
 	if err != nil {
-		return fmt.Errorf("mounttable.NewMountTable failed: %s", err)
+		return fmt.Errorf("mounttable.NewMountTableDispatcher failed: %s", err)
 	}
 	eps, err := server.Listen(lspec)
 	if err != nil {
@@ -69,11 +74,6 @@
 	ctx, shutdown := veyron2.Init()
 	defer shutdown()
 
-	details := false
-	if len(args) > 0 && args[0] == "-l" {
-		details = true
-		args = args[1:]
-	}
 	ns := veyron2.GetNamespace(ctx)
 	entry := 0
 	output := ""
@@ -83,7 +83,7 @@
 			return err
 		}
 		for n := range ch {
-			if details {
+			if *details {
 				output += fmt.Sprintf("R%d=%s[", entry, n.Name)
 				t := ""
 				for _, s := range n.Servers {
diff --git a/runtimes/google/ipc/client.go b/runtimes/google/ipc/client.go
index a534864..15c86de 100644
--- a/runtimes/google/ipc/client.go
+++ b/runtimes/google/ipc/client.go
@@ -112,7 +112,6 @@
 }
 
 var _ ipc.Client = (*client)(nil)
-var _ ipc.BindOpt = (*client)(nil)
 
 type vcInfo struct {
 	vc       stream.VC
@@ -686,11 +685,6 @@
 	c.vcMapMu.Unlock()
 }
 
-// IPCBindOpt makes client implement BindOpt.
-func (c *client) IPCBindOpt() {
-	//nologcall
-}
-
 // flowClient implements the RPC client-side protocol for a single RPC, over a
 // flow that's already connected to the server.
 type flowClient struct {
diff --git a/runtimes/google/naming/namespace/all_test.go b/runtimes/google/naming/namespace/all_test.go
index 170cfac..f57b00c 100644
--- a/runtimes/google/naming/namespace/all_test.go
+++ b/runtimes/google/naming/namespace/all_test.go
@@ -167,11 +167,11 @@
 }
 
 func runMT(t *testing.T, ctx *context.T, mountPoint string) *serverEntry {
-	mt, err := service.NewMountTable("")
+	mtd, err := service.NewMountTableDispatcher("")
 	if err != nil {
-		boom(t, "NewMountTable returned error: %v", err)
+		boom(t, "NewMountTableDispatcher returned error: %v", err)
 	}
-	return run(t, ctx, mt, mountPoint, true)
+	return run(t, ctx, mtd, mountPoint, true)
 }
 
 func run(t *testing.T, ctx *context.T, disp ipc.Dispatcher, mountPoint string, mt bool) *serverEntry {
diff --git a/runtimes/google/testing/mocks/ipc/simple_client.go b/runtimes/google/testing/mocks/ipc/simple_client.go
index e9ce243..7ce530b 100644
--- a/runtimes/google/testing/mocks/ipc/simple_client.go
+++ b/runtimes/google/testing/mocks/ipc/simple_client.go
@@ -13,18 +13,23 @@
 	"v.io/core/veyron2/vom"
 )
 
+type ClientWithTimesCalled interface {
+	ipc.Client
+	TimesCalled(method string) int
+}
+
 // NewSimpleClient creates a new mocked ipc client where the given map of method name
 // to outputs is used for evaluating the method calls.
 // It also adds some testing features such as counters for number of times a method is called
-func NewSimpleClient(methodsResults map[string][]interface{}) *SimpleMockClient {
-	return &SimpleMockClient{
+func NewSimpleClient(methodsResults map[string][]interface{}) ClientWithTimesCalled {
+	return &simpleMockClient{
 		results:     methodsResults,
 		timesCalled: make(map[string]int),
 	}
 }
 
-// SimpleMockClient implements ipc.Client
-type SimpleMockClient struct {
+// simpleMockClient implements ipc.Client
+type simpleMockClient struct {
 	// Protects timesCalled
 	sync.Mutex
 
@@ -35,17 +40,12 @@
 }
 
 // TimesCalled returns number of times the given method has been called.
-func (c *SimpleMockClient) TimesCalled(method string) int {
+func (c *simpleMockClient) TimesCalled(method string) int {
 	return c.timesCalled[method]
 }
 
-// IPCBindOpt Implements ipc.Client
-func (c *SimpleMockClient) IPCBindOpt() {
-	//nologcall
-}
-
 // StartCall Implements ipc.Client
-func (c *SimpleMockClient) StartCall(ctx *context.T, name, method string, args []interface{}, opts ...ipc.CallOpt) (ipc.Call, error) {
+func (c *simpleMockClient) StartCall(ctx *context.T, name, method string, args []interface{}, opts ...ipc.CallOpt) (ipc.Call, error) {
 	defer vlog.LogCall()()
 	results, ok := c.results[method]
 	if !ok {
@@ -77,7 +77,7 @@
 }
 
 // Close implements ipc.Client
-func (*SimpleMockClient) Close() {
+func (*simpleMockClient) Close() {
 	defer vlog.LogCall()()
 }
 
diff --git a/services/identity/server/identityd.go b/services/identity/server/identityd.go
index b415f20..3416ef8 100644
--- a/services/identity/server/identityd.go
+++ b/services/identity/server/identityd.go
@@ -43,7 +43,7 @@
 	dischargerService   = "discharger"
 )
 
-type identityd struct {
+type IdentityServer struct {
 	oauthProvider      oauth.OAuthProvider
 	auditor            audit.Auditor
 	blessingLogReader  auditor.BlessingLogReader
@@ -58,8 +58,8 @@
 // - auditor and blessingLogReader to audit the root principal and read audit logs
 // - revocationManager to store revocation data and grant discharges
 // - oauthBlesserParams to configure the identity.OAuthBlesser service
-func NewIdentityServer(oauthProvider oauth.OAuthProvider, auditor audit.Auditor, blessingLogReader auditor.BlessingLogReader, revocationManager revocation.RevocationManager, oauthBlesserParams blesser.OAuthBlesserParams, caveatSelector caveats.CaveatSelector, emailClassifier *util.EmailClassifier) *identityd {
-	return &identityd{
+func NewIdentityServer(oauthProvider oauth.OAuthProvider, auditor audit.Auditor, blessingLogReader auditor.BlessingLogReader, revocationManager revocation.RevocationManager, oauthBlesserParams blesser.OAuthBlesserParams, caveatSelector caveats.CaveatSelector, emailClassifier *util.EmailClassifier) *IdentityServer {
+	return &IdentityServer{
 		oauthProvider,
 		auditor,
 		blessingLogReader,
@@ -70,7 +70,7 @@
 	}
 }
 
-func (s *identityd) Serve(ctx *context.T, listenSpec *ipc.ListenSpec, host, httpaddr, tlsconfig string) {
+func (s *IdentityServer) Serve(ctx *context.T, listenSpec *ipc.ListenSpec, host, httpaddr, tlsconfig string) {
 	ctx, err := veyron2.SetPrincipal(ctx, audit.NewPrincipal(
 		veyron2.GetPrincipal(ctx), s.auditor))
 	if err != nil {
@@ -80,7 +80,7 @@
 	<-signals.ShutdownOnSignals(ctx)
 }
 
-func (s *identityd) Listen(ctx *context.T, listenSpec *ipc.ListenSpec, host, httpaddr, tlsconfig string) (ipc.Server, []string, string) {
+func (s *IdentityServer) Listen(ctx *context.T, listenSpec *ipc.ListenSpec, host, httpaddr, tlsconfig string) (ipc.Server, []string, string) {
 	// Setup handlers
 
 	// json-encoded public key and blessing names of this server
@@ -153,7 +153,7 @@
 }
 
 // Starts the blessing services and the discharging service on the same port.
-func (s *identityd) setupServices(ctx *context.T, listenSpec *ipc.ListenSpec, macaroonKey []byte) (ipc.Server, []string, error) {
+func (s *IdentityServer) setupServices(ctx *context.T, listenSpec *ipc.ListenSpec, macaroonKey []byte) (ipc.Server, []string, error) {
 	server, err := veyron2.NewServer(ctx)
 	if err != nil {
 		return nil, nil, fmt.Errorf("failed to create new ipc.Server: %v", err)
diff --git a/services/mgmt/application/impl/dispatcher.go b/services/mgmt/application/impl/dispatcher.go
index 6b13186..b08cddd 100644
--- a/services/mgmt/application/impl/dispatcher.go
+++ b/services/mgmt/application/impl/dispatcher.go
@@ -3,6 +3,7 @@
 import (
 	"path/filepath"
 
+	"v.io/core/veyron2/ipc"
 	"v.io/core/veyron2/naming"
 	"v.io/core/veyron2/security"
 	"v.io/core/veyron2/services/security/access"
@@ -22,7 +23,7 @@
 
 // NewDispatcher is the dispatcher factory. storeDir is a path to a directory in which to
 // serialize the applicationd state.
-func NewDispatcher(storeDir string) (*dispatcher, error) {
+func NewDispatcher(storeDir string) (ipc.Dispatcher, error) {
 	store, err := fs.NewMemstore(filepath.Join(storeDir, "applicationdstate.db"))
 	if err != nil {
 		return nil, err
diff --git a/services/mgmt/application/impl/service.go b/services/mgmt/application/impl/service.go
index 8ad14cd..fa6dfc5 100644
--- a/services/mgmt/application/impl/service.go
+++ b/services/mgmt/application/impl/service.go
@@ -5,6 +5,7 @@
 
 	"v.io/core/veyron/services/mgmt/lib/acls"
 	"v.io/core/veyron/services/mgmt/lib/fs"
+	"v.io/core/veyron/services/mgmt/repository"
 
 	"v.io/core/veyron2/ipc"
 	"v.io/core/veyron2/naming"
@@ -37,7 +38,7 @@
 )
 
 // NewApplicationService returns a new Application service implementation.
-func NewApplicationService(store *fs.Memstore, storeRoot, suffix string) *appRepoService {
+func NewApplicationService(store *fs.Memstore, storeRoot, suffix string) repository.ApplicationServerMethods {
 	return &appRepoService{store: store, storeRoot: storeRoot, suffix: suffix}
 }
 
diff --git a/services/mgmt/binary/impl/dispatcher.go b/services/mgmt/binary/impl/dispatcher.go
index a8538d3..df9fc64 100644
--- a/services/mgmt/binary/impl/dispatcher.go
+++ b/services/mgmt/binary/impl/dispatcher.go
@@ -5,6 +5,7 @@
 	"os"
 	"path/filepath"
 
+	"v.io/core/veyron2/ipc"
 	"v.io/core/veyron2/security"
 	"v.io/core/veyron2/services/mgmt/repository"
 	"v.io/core/veyron2/services/security/access"
@@ -26,7 +27,7 @@
 }
 
 // NewDispatcher is the dispatcher factory.
-func NewDispatcher(principal security.Principal, state *state) (*dispatcher, error) {
+func NewDispatcher(principal security.Principal, state *state) (ipc.Dispatcher, error) {
 	return &dispatcher{
 		state:     state,
 		locks:     acls.NewLocks(),
diff --git a/services/mgmt/build/impl/service.go b/services/mgmt/build/impl/service.go
index e5569b4..6e2395b 100644
--- a/services/mgmt/build/impl/service.go
+++ b/services/mgmt/build/impl/service.go
@@ -30,7 +30,7 @@
 }
 
 // NewBuilderService returns a new Build service implementation.
-func NewBuilderService(gobin, goroot string) *builderService {
+func NewBuilderService(gobin, goroot string) build.BuilderServerMethods {
 	return &builderService{
 		gobin:  gobin,
 		goroot: goroot,
diff --git a/services/mgmt/debug/dispatcher.go b/services/mgmt/debug/dispatcher.go
index 02d10bb..205ae58 100644
--- a/services/mgmt/debug/dispatcher.go
+++ b/services/mgmt/debug/dispatcher.go
@@ -21,7 +21,7 @@
 
 var _ ipc.Dispatcher = (*dispatcher)(nil)
 
-func NewDispatcher(logsDir string, authorizer security.Authorizer) *dispatcher {
+func NewDispatcher(logsDir string, authorizer security.Authorizer) ipc.Dispatcher {
 	return &dispatcher{logsDir, authorizer}
 }
 
diff --git a/services/mgmt/profile/impl/dispatcher.go b/services/mgmt/profile/impl/dispatcher.go
index 40f04e8..35396a1 100644
--- a/services/mgmt/profile/impl/dispatcher.go
+++ b/services/mgmt/profile/impl/dispatcher.go
@@ -3,11 +3,11 @@
 import (
 	"path/filepath"
 
-	"v.io/core/veyron/services/mgmt/repository"
-
-	"v.io/core/veyron/services/mgmt/lib/fs"
 	"v.io/core/veyron2/ipc"
 	"v.io/core/veyron2/security"
+
+	"v.io/core/veyron/services/mgmt/lib/fs"
+	"v.io/core/veyron/services/mgmt/repository"
 )
 
 // dispatcher holds the state of the profile repository dispatcher.
@@ -21,7 +21,7 @@
 
 // NewDispatcher is the dispatcher factory. storeDir is a path to a
 // directory in which the profile state is persisted.
-func NewDispatcher(storeDir string, authorizer security.Authorizer) (*dispatcher, error) {
+func NewDispatcher(storeDir string, authorizer security.Authorizer) (ipc.Dispatcher, error) {
 	store, err := fs.NewMemstore(filepath.Join(storeDir, "profilestate.db"))
 	if err != nil {
 		return nil, err
diff --git a/services/mgmt/profile/impl/service.go b/services/mgmt/profile/impl/service.go
index 329672b..f528d5a 100644
--- a/services/mgmt/profile/impl/service.go
+++ b/services/mgmt/profile/impl/service.go
@@ -5,6 +5,7 @@
 
 	"v.io/core/veyron/services/mgmt/lib/fs"
 	"v.io/core/veyron/services/mgmt/profile"
+	"v.io/core/veyron/services/mgmt/repository"
 
 	"v.io/core/veyron2/ipc"
 	"v.io/core/veyron2/naming"
@@ -27,7 +28,7 @@
 )
 
 // NewProfileService returns a new Profile service implementation.
-func NewProfileService(store *fs.Memstore, storeRoot, suffix string) *profileService {
+func NewProfileService(store *fs.Memstore, storeRoot, suffix string) repository.ProfileServerMethods {
 	return &profileService{store: store, storeRoot: storeRoot, suffix: suffix}
 }
 
diff --git a/services/mounttable/lib/mounttable.go b/services/mounttable/lib/mounttable.go
index 9280527..93f0926 100644
--- a/services/mounttable/lib/mounttable.go
+++ b/services/mounttable/lib/mounttable.go
@@ -69,13 +69,13 @@
 
 const templateVar = "%%"
 
-// NewMountTable creates a new server that uses the ACLs specified in
+// NewMountTableDispatcher creates a new server that uses the ACLs specified in
 // aclfile for authorization.
 //
 // aclfile is a JSON-encoded mapping from paths in the mounttable to the
 // access.TaggedACLMap for that path. The tags used in the map are the typical
 // access tags (the Tag type defined in veyron2/services/security/access).
-func NewMountTable(aclfile string) (*mountTable, error) {
+func NewMountTableDispatcher(aclfile string) (ipc.Dispatcher, error) {
 	mt := &mountTable{
 		root: new(node),
 	}
@@ -413,11 +413,23 @@
 
 // Mount a server onto the name in the receiver.
 func (ms *mountContext) Mount(ctx ipc.ServerContext, server string, ttlsecs uint32, flags naming.MountFlag) error {
+	return ms.MountX(ctx, server, nil, ttlsecs, flags)
+}
+
+func (ms *mountContext) MountX(ctx ipc.ServerContext, server string, patterns []security.BlessingPattern, ttlsecs uint32, flags naming.MountFlag) error {
+	if len(patterns) == 0 {
+		// No patterns provided in the request, take the conservative
+		// approach and assume that the server being mounted will
+		// present the same blessings as the client calling Mount.
+		for _, b := range ctx.RemoteBlessings().ForContext(ctx) {
+			patterns = append(patterns, security.BlessingPattern(b))
+		}
+	}
 	mt := ms.mt
 	if ttlsecs == 0 {
 		ttlsecs = 10 * 365 * 24 * 60 * 60 // a really long time
 	}
-	vlog.VI(2).Infof("*********************Mount %q -> %s", ms.name, server)
+	vlog.VI(2).Infof("*********************Mount %q -> %v%s", ms.name, patterns, server)
 
 	// Make sure the server address is reasonable.
 	epString := server
@@ -445,13 +457,13 @@
 	}
 	wantMT := hasMTFlag(flags)
 	if n.mount == nil {
-		n.mount = &mount{servers: NewServerList(), mt: wantMT}
+		n.mount = &mount{servers: newServerList(), mt: wantMT}
 	} else {
 		if wantMT != n.mount.mt {
 			return fmt.Errorf("MT doesn't match")
 		}
 	}
-	n.mount.servers.add(server, time.Duration(ttlsecs)*time.Second)
+	n.mount.servers.add(server, patterns, time.Duration(ttlsecs)*time.Second)
 	return nil
 }
 
diff --git a/services/mounttable/lib/mounttable_test.go b/services/mounttable/lib/mounttable_test.go
index a1404d9..7ac6586 100644
--- a/services/mounttable/lib/mounttable_test.go
+++ b/services/mounttable/lib/mounttable_test.go
@@ -2,7 +2,6 @@
 
 import (
 	"errors"
-	"fmt"
 	"io"
 	"reflect"
 	"runtime/debug"
@@ -33,10 +32,10 @@
 	t.Fatal(string(debug.Stack()))
 }
 
-func doMount(t *testing.T, ctx *context.T, ep, suffix, service string, shouldSucceed bool) {
+func doMount(t *testing.T, ctx *context.T, ep, suffix, service string, blessingPatterns []security.BlessingPattern, shouldSucceed bool) {
 	name := naming.JoinAddressName(ep, suffix)
 	client := veyron2.GetClient(ctx)
-	call, err := client.StartCall(ctx, name, "Mount", []interface{}{service, uint32(ttlSecs), 0}, options.NoResolve{})
+	call, err := client.StartCall(ctx, name, "MountX", []interface{}{service, blessingPatterns, uint32(ttlSecs), 0}, options.NoResolve{})
 	if err != nil {
 		if !shouldSucceed {
 			return
@@ -179,22 +178,33 @@
 	}
 }
 
-// resolve assumes that the mount contains 0 or 1 servers.
-func resolve(ctx *context.T, name string) (string, error) {
+func mountentry2names(e *naming.VDLMountEntry) []string {
+	names := make([]string, len(e.Servers))
+	for idx, s := range e.Servers {
+		names[idx] = naming.JoinAddressName(s.Server, e.Name)
+	}
+	return names
+}
+
+func strslice(strs ...string) []string {
+	return strs
+}
+
+func resolve(ctx *context.T, name string) (*naming.VDLMountEntry, error) {
 	// Resolve the name one level.
 	client := veyron2.GetClient(ctx)
 	call, err := client.StartCall(ctx, name, "ResolveStep", nil, options.NoResolve{})
 	if err != nil {
-		return "", err
+		return nil, err
 	}
 	var entry naming.VDLMountEntry
 	if ierr := call.Finish(&entry, &err); ierr != nil {
-		return "", ierr
+		return nil, ierr
 	}
 	if len(entry.Servers) < 1 {
-		return "", errors.New("resolve returned no servers")
+		return nil, errors.New("resolve returned no servers")
 	}
-	return naming.JoinAddressName(entry.Servers[0].Server, entry.Name), nil
+	return &entry, nil
 }
 
 func export(t *testing.T, ctx *context.T, name, contents string) {
@@ -205,7 +215,7 @@
 	}
 	// Export the value.
 	client := veyron2.GetClient(ctx)
-	call, err := client.StartCall(ctx, resolved, "Export", []interface{}{contents, true}, options.NoResolve{})
+	call, err := client.StartCall(ctx, mountentry2names(resolved)[0], "Export", []interface{}{contents, true}, options.NoResolve{})
 	if err != nil {
 		boom(t, "Failed to Export.StartCall %s to %s: %s", name, contents, err)
 	}
@@ -228,7 +238,7 @@
 	}
 	// Look up the value.
 	client := veyron2.GetClient(ctx)
-	call, err := client.StartCall(ctx, resolved, "Lookup", nil, options.NoResolve{})
+	call, err := client.StartCall(ctx, mountentry2names(resolved)[0], "Lookup", nil, options.NoResolve{})
 	if err != nil {
 		if shouldSucceed {
 			boom(t, "Failed Lookup.StartCall %s: %s", name, err)
@@ -259,9 +269,9 @@
 		boom(t, "r.NewServer: %s", err)
 	}
 	// Add mount table service.
-	mt, err := NewMountTable(acl)
+	mt, err := NewMountTableDispatcher(acl)
 	if err != nil {
-		boom(t, "NewMountTable: %v", err)
+		boom(t, "NewMountTableDispatcher: %v", err)
 	}
 	// Start serving on a loopback address.
 	eps, err := server.Listen(veyron2.GetListenSpec(rootCtx))
@@ -310,7 +320,7 @@
 
 	// Mount the collection server into the mount table.
 	vlog.Infof("Mount the collection server into the mount table.")
-	doMount(t, rootCtx, mtAddr, "stuff", collectionName, true)
+	doMount(t, rootCtx, mtAddr, "stuff", collectionName, nil, true)
 
 	// Create a few objects and make sure we can read them.
 	vlog.Infof("Create a few objects.")
@@ -328,9 +338,9 @@
 
 	// Test multiple mounts.
 	vlog.Infof("Multiple mounts.")
-	doMount(t, rootCtx, mtAddr, "a/b", collectionName, true)
-	doMount(t, rootCtx, mtAddr, "x/y", collectionName, true)
-	doMount(t, rootCtx, mtAddr, "alpha//beta", collectionName, true)
+	doMount(t, rootCtx, mtAddr, "a/b", collectionName, nil, true)
+	doMount(t, rootCtx, mtAddr, "x/y", collectionName, nil, true)
+	doMount(t, rootCtx, mtAddr, "alpha//beta", collectionName, nil, true)
 	vlog.Infof("Make sure we can read them.")
 	checkContents(t, rootCtx, naming.JoinAddressName(mtAddr, "stuff/falls"), "falls mainly on the plain", true)
 	checkContents(t, rootCtx, naming.JoinAddressName(mtAddr, "a/b/falls"), "falls mainly on the plain", true)
@@ -360,7 +370,7 @@
 
 	// Test specific unmount.
 	vlog.Info("Test specific unmount.")
-	doMount(t, rootCtx, mtAddr, "a/b", collectionName, true)
+	doMount(t, rootCtx, mtAddr, "a/b", collectionName, nil, true)
 	doUnmount(t, rootCtx, mtAddr, "a/b", collectionName, true)
 	checkContents(t, rootCtx, naming.JoinAddressName(mtAddr, "a/b/falls"), "falls mainly on the plain", false)
 
@@ -368,15 +378,15 @@
 	vlog.Info("Try timing out a mount.")
 	ft := NewFakeTimeClock()
 	setServerListClock(ft)
-	doMount(t, rootCtx, mtAddr, "stuffWithTTL", collectionName, true)
+	doMount(t, rootCtx, mtAddr, "stuffWithTTL", collectionName, nil, true)
 	checkContents(t, rootCtx, naming.JoinAddressName(mtAddr, "stuffWithTTL/the/rain"), "the rain", true)
 	ft.advance(time.Duration(ttlSecs+4) * time.Second)
 	checkContents(t, rootCtx, naming.JoinAddressName(mtAddr, "stuffWithTTL/the/rain"), "the rain", false)
 
 	// Test unauthorized mount.
 	vlog.Info("Test unauthorized mount.")
-	doMount(t, bobCtx, mtAddr, "/a/b", collectionName, false)
-	doMount(t, aliceCtx, mtAddr, "/a/b", collectionName, false)
+	doMount(t, bobCtx, mtAddr, "/a/b", collectionName, nil, false)
+	doMount(t, aliceCtx, mtAddr, "/a/b", collectionName, nil, false)
 
 	doUnmount(t, bobCtx, mtAddr, "x/y", collectionName, false)
 }
@@ -456,9 +466,9 @@
 
 	// set up a mount space
 	fakeServer := naming.JoinAddressName(estr, "quux")
-	doMount(t, rootCtx, estr, "one/bright/day", fakeServer, true)
-	doMount(t, rootCtx, estr, "in/the/middle", fakeServer, true)
-	doMount(t, rootCtx, estr, "of/the/night", fakeServer, true)
+	doMount(t, rootCtx, estr, "one/bright/day", fakeServer, nil, true)
+	doMount(t, rootCtx, estr, "in/the/middle", fakeServer, nil, true)
+	doMount(t, rootCtx, estr, "of/the/night", fakeServer, nil, true)
 
 	// Try various globs.
 	tests := []struct {
@@ -503,14 +513,14 @@
 	fakeServer := naming.JoinAddressName(estr, "quux")
 
 	// Noone should be able to mount on someone else's names.
-	doMount(t, aliceCtx, estr, "users/ted", fakeServer, false)
-	doMount(t, bobCtx, estr, "users/carol", fakeServer, false)
-	doMount(t, rootCtx, estr, "users/george", fakeServer, false)
+	doMount(t, aliceCtx, estr, "users/ted", fakeServer, nil, false)
+	doMount(t, bobCtx, estr, "users/carol", fakeServer, nil, false)
+	doMount(t, rootCtx, estr, "users/george", fakeServer, nil, false)
 
 	// Anyone should be able to mount on their own names.
-	doMount(t, aliceCtx, estr, "users/alice", fakeServer, true)
-	doMount(t, bobCtx, estr, "users/bob", fakeServer, true)
-	doMount(t, rootCtx, estr, "users/root", fakeServer, true)
+	doMount(t, aliceCtx, estr, "users/alice", fakeServer, nil, true)
+	doMount(t, bobCtx, estr, "users/bob", fakeServer, nil, true)
+	doMount(t, rootCtx, estr, "users/root", fakeServer, nil, true)
 }
 
 func TestGlobACLs(t *testing.T) {
@@ -522,9 +532,9 @@
 
 	// set up a mount space
 	fakeServer := naming.JoinAddressName(estr, "quux")
-	doMount(t, aliceCtx, estr, "one/bright/day", fakeServer, false) // Fails because alice can't mount there.
-	doMount(t, bobCtx, estr, "one/bright/day", fakeServer, true)
-	doMount(t, rootCtx, estr, "a/b/c", fakeServer, true)
+	doMount(t, aliceCtx, estr, "one/bright/day", fakeServer, nil, false) // Fails because alice can't mount there.
+	doMount(t, bobCtx, estr, "one/bright/day", fakeServer, nil, true)
+	doMount(t, rootCtx, estr, "a/b/c", fakeServer, nil, true)
 
 	// Try various globs.
 	tests := []struct {
@@ -555,7 +565,7 @@
 
 	// Set up one mount.
 	fakeServer := naming.JoinAddressName(estr, "quux")
-	doMount(t, rootCtx, estr, "one/bright/day", fakeServer, true)
+	doMount(t, rootCtx, estr, "one/bright/day", fakeServer, nil, true)
 	checkMatch(t, []string{"one", "one/bright", "one/bright/day"}, doGlob(t, rootCtx, estr, "", "*/..."))
 
 	// After the unmount nothing should be left
@@ -563,7 +573,7 @@
 	checkMatch(t, nil, doGlob(t, rootCtx, estr, "", "*/..."))
 
 	// Set up a mount, then set the ACL.
-	doMount(t, rootCtx, estr, "one/bright/day", fakeServer, true)
+	doMount(t, rootCtx, estr, "one/bright/day", fakeServer, nil, true)
 	checkMatch(t, []string{"one", "one/bright", "one/bright/day"}, doGlob(t, rootCtx, estr, "", "*/..."))
 	acl := access.TaggedACLMap{"Read": access.ACL{In: []security.BlessingPattern{security.BlessingPattern("...")}}}
 	doSetACL(t, rootCtx, estr, "one/bright", acl, "", true)
@@ -582,8 +592,8 @@
 
 	// set up a mount space
 	fakeServer := naming.JoinAddressName(estr, "quux")
-	doMount(t, bobCtx, estr, "one/bright/day", fakeServer, true)
-	doMount(t, rootCtx, estr, "a/b/c", fakeServer, true)
+	doMount(t, bobCtx, estr, "one/bright/day", fakeServer, nil, true)
+	doMount(t, rootCtx, estr, "a/b/c", fakeServer, nil, true)
 
 	// It shouldn't be possible to delete anything with children unless explicitly requested.
 	doDeleteNode(t, rootCtx, estr, "a/b", false)
@@ -607,12 +617,12 @@
 	server, estr := newMT(t, "", rootCtx)
 	defer server.Stop()
 
-	doMount(t, rootCtx, estr, "endpoint", naming.JoinAddressName(estr, "life/on/the/mississippi"), true)
-	doMount(t, rootCtx, estr, "hostport", "/atrampabroad:8000", true)
-	doMount(t, rootCtx, estr, "hostport-endpoint-platypus", "/@atrampabroad:8000@@", true)
-	doMount(t, rootCtx, estr, "invalid/not/rooted", "atrampabroad:8000", false)
-	doMount(t, rootCtx, estr, "invalid/no/port", "/atrampabroad", false)
-	doMount(t, rootCtx, estr, "invalid/endpoint", "/@following the equator:8000@@@", false)
+	doMount(t, rootCtx, estr, "endpoint", naming.JoinAddressName(estr, "life/on/the/mississippi"), nil, true)
+	doMount(t, rootCtx, estr, "hostport", "/atrampabroad:8000", nil, true)
+	doMount(t, rootCtx, estr, "hostport-endpoint-platypus", "/@atrampabroad:8000@@", nil, true)
+	doMount(t, rootCtx, estr, "invalid/not/rooted", "atrampabroad:8000", nil, false)
+	doMount(t, rootCtx, estr, "invalid/no/port", "/atrampabroad", nil, false)
+	doMount(t, rootCtx, estr, "invalid/endpoint", "/@following the equator:8000@@@", nil, false)
 }
 
 func TestExpiry(t *testing.T) {
@@ -628,10 +638,10 @@
 
 	ft := NewFakeTimeClock()
 	setServerListClock(ft)
-	doMount(t, rootCtx, estr, "a1/b1", collectionName, true)
-	doMount(t, rootCtx, estr, "a1/b2", collectionName, true)
-	doMount(t, rootCtx, estr, "a2/b1", collectionName, true)
-	doMount(t, rootCtx, estr, "a2/b2/c", collectionName, true)
+	doMount(t, rootCtx, estr, "a1/b1", collectionName, nil, true)
+	doMount(t, rootCtx, estr, "a1/b2", collectionName, nil, true)
+	doMount(t, rootCtx, estr, "a2/b1", collectionName, nil, true)
+	doMount(t, rootCtx, estr, "a2/b2/c", collectionName, nil, true)
 
 	checkMatch(t, []string{"a1/b1", "a2/b1"}, doGlob(t, rootCtx, estr, "", "*/b1/..."))
 	ft.advance(time.Duration(ttlSecs/2) * time.Second)
@@ -639,27 +649,66 @@
 	checkMatch(t, []string{"c"}, doGlob(t, rootCtx, estr, "a2/b2", "*"))
 	// Refresh only a1/b1.  All the other mounts will expire upon the next
 	// ft advance.
-	doMount(t, rootCtx, estr, "a1/b1", collectionName, true)
+	doMount(t, rootCtx, estr, "a1/b1", collectionName, nil, true)
 	ft.advance(time.Duration(ttlSecs/2+4) * time.Second)
 	checkMatch(t, []string{"a1", "a1/b1"}, doGlob(t, rootCtx, estr, "", "*/..."))
 	checkMatch(t, []string{"a1/b1"}, doGlob(t, rootCtx, estr, "", "*/b1/..."))
 }
 
 func TestBadACLs(t *testing.T) {
-	_, err := NewMountTable("testdata/invalid.acl")
+	_, err := NewMountTableDispatcher("testdata/invalid.acl")
 	if err == nil {
 		boom(t, "Expected json parse error in acl file")
 	}
-	_, err = NewMountTable("testdata/doesntexist.acl")
+	_, err = NewMountTableDispatcher("testdata/doesntexist.acl")
 	if err == nil {
 		boom(t, "Expected error from missing acl file")
 	}
 }
 
+func TestBlessingPatterns(t *testing.T) {
+	// TODO(ashankar): Change this test to use a variant of checkContents
+	// that will ensure that the client call to the resolved name fails if
+	// the blessing patterns in the mount entry is not consistent with the
+	// blessings presented by the end server (once the namespace library
+	// changes to respect VDLMountedServer.BlessingPatterns is in place).
+	rootCtx, aliceCtx, bobCtx, shutdown := initTest()
+	defer shutdown()
+
+	mt, mtAddr := newMT(t, "testdata/test.acl", rootCtx)
+	defer mt.Stop()
+
+	// collection server run by alice
+	collection, collectionAddr := newCollection(t, "testdata/test.acl", aliceCtx)
+	defer collection.Stop()
+	suffix := "users/bob"
+
+	// But mounted by bob, and since bob didn't specify an explicit set of
+	// blessing patterns, it will be thought of as bob's server.
+	doMount(t, bobCtx, mtAddr, suffix, collectionAddr, nil, true)
+	if e, err := resolve(aliceCtx, naming.JoinAddressName(mtAddr, suffix)); err != nil {
+		t.Error(err)
+	} else if len(e.Servers) != 1 {
+		t.Errorf("Got %v, want exactly 1 server", e.Servers)
+	} else if got, want := e.Servers[0].BlessingPatterns, strslice("bob"); !reflect.DeepEqual(got, want) {
+		t.Errorf("Got blessing patterns %v, want %v", got, want)
+	}
+	doUnmount(t, bobCtx, mtAddr, suffix, "", true)
+
+	// However, if bob explicitly says alice is running the server, then so be it.
+	doMount(t, bobCtx, mtAddr, suffix, collectionAddr, []security.BlessingPattern{"alice", "somebody"}, true)
+	if e, err := resolve(aliceCtx, naming.JoinAddressName(mtAddr, suffix)); err != nil {
+		t.Error(err)
+	} else if len(e.Servers) != 1 {
+		t.Errorf("Got %v, want exactly 1 server", e.Servers)
+	} else if got, want := e.Servers[0].BlessingPatterns, strslice("alice", "somebody"); !reflect.DeepEqual(got, want) {
+		t.Errorf("Got blessing patterns %v, want %v", got, want)
+	}
+}
+
 func initTest() (rootCtx *context.T, aliceCtx *context.T, bobCtx *context.T, shutdown veyron2.Shutdown) {
 	testutil.Init()
 	ctx, shutdown := testutil.InitForTest()
-
 	var err error
 	if rootCtx, err = veyron2.SetPrincipal(ctx, tsecurity.NewPrincipal("root")); err != nil {
 		panic("failed to set root principal")
@@ -670,38 +719,19 @@
 	if bobCtx, err = veyron2.SetPrincipal(ctx, tsecurity.NewPrincipal("bob")); err != nil {
 		panic("failed to set bob principal")
 	}
-
-	// A hack to set the namespace roots to a value that won't work.
 	for _, r := range []*context.T{rootCtx, aliceCtx, bobCtx} {
+		// A hack to set the namespace roots to a value that won't work.
 		veyron2.GetNamespace(r).SetRoots()
-	}
-
-	// And setup their blessings so that they present "root", "alice" and "bob"
-	// and these blessings are recognized by the others.
-	principals := map[string]security.Principal{
-		"root":  veyron2.GetPrincipal(rootCtx),
-		"alice": veyron2.GetPrincipal(aliceCtx),
-		"bob":   veyron2.GetPrincipal(bobCtx),
-	}
-	for name, p := range principals {
-		blessing, err := p.BlessSelf(name)
-		if err != nil {
-			panic(fmt.Sprintf("BlessSelf(%q) failed: %v", name, err))
-		}
-		// Share this blessing with all servers and use it when serving clients.
-		if err = p.BlessingStore().SetDefault(blessing); err != nil {
-			panic(fmt.Sprintf("%v: %v", blessing, err))
-		}
-		if _, err = p.BlessingStore().Set(blessing, security.AllPrincipals); err != nil {
-			panic(fmt.Sprintf("%v: %v", blessing, err))
-		}
-		// Have all principals trust the root of this blessing.
-		for _, other := range principals {
-			if err := other.AddToRoots(blessing); err != nil {
+		// And have all principals recognize each others blessings.
+		p1 := veyron2.GetPrincipal(r)
+		for _, other := range []*context.T{rootCtx, aliceCtx, bobCtx} {
+			// tsecurity.NewPrincipal has already setup each
+			// principal to use the same blessing for both server
+			// and client activities.
+			if err := p1.AddToRoots(veyron2.GetPrincipal(other).BlessingStore().Default()); err != nil {
 				panic(err)
 			}
 		}
 	}
-
 	return rootCtx, aliceCtx, bobCtx, shutdown
 }
diff --git a/services/mounttable/lib/neighborhood.go b/services/mounttable/lib/neighborhood.go
index f915124..259aec2 100644
--- a/services/mounttable/lib/neighborhood.go
+++ b/services/mounttable/lib/neighborhood.go
@@ -65,7 +65,7 @@
 	return uint16(port)
 }
 
-func newNeighborhoodServer(host string, addresses []string, loopback bool) (*neighborhood, error) {
+func newNeighborhood(host string, addresses []string, loopback bool) (*neighborhood, error) {
 	// Create the TXT contents with addresses to announce. Also pick up a port number.
 	var txt []string
 	var port uint16
@@ -115,14 +115,16 @@
 	return nh, nil
 }
 
-// NewLoopbackNeighborhoodServer creates a new instance of a neighborhood server on loopback interfaces for testing.
-func NewLoopbackNeighborhoodServer(host string, addresses ...string) (*neighborhood, error) {
-	return newNeighborhoodServer(host, addresses, true)
+// NewLoopbackNeighborhoodDispatcher creates a new instance of a dispatcher for
+// a neighborhood service provider on loopback interfaces (meant for testing).
+func NewLoopbackNeighborhoodDispatcher(host string, addresses ...string) (ipc.Dispatcher, error) {
+	return newNeighborhood(host, addresses, true)
 }
 
-// NewNeighborhoodServer creates a new instance of a neighborhood server.
-func NewNeighborhoodServer(host string, addresses ...string) (*neighborhood, error) {
-	return newNeighborhoodServer(host, addresses, false)
+// NewNeighborhoodDispatcher creates a new instance of a dispatcher for a
+// neighborhood service provider.
+func NewNeighborhoodDispatcher(host string, addresses ...string) (ipc.Dispatcher, error) {
+	return newNeighborhood(host, addresses, false)
 }
 
 // Lookup implements ipc.Dispatcher.Lookup.
@@ -173,7 +175,7 @@
 		}
 	}
 	for addr, ttl := range addrMap {
-		reply = append(reply, naming.VDLMountedServer{addr, ttl})
+		reply = append(reply, naming.VDLMountedServer{addr, nil, ttl})
 	}
 
 	if reply != nil {
@@ -189,7 +191,7 @@
 		for _, ip := range ips {
 			addr := net.JoinHostPort(ip.String(), strconv.Itoa(int(rr.Port)))
 			ep := naming.FormatEndpoint("tcp", addr)
-			reply = append(reply, naming.VDLMountedServer{naming.JoinAddressName(ep, ""), ttl})
+			reply = append(reply, naming.VDLMountedServer{naming.JoinAddressName(ep, ""), nil, ttl})
 		}
 	}
 	return reply
@@ -237,7 +239,10 @@
 }
 
 // Mount not implemented.
-func (*neighborhoodService) Mount(_ ipc.ServerContext, server string, ttlsecs uint32, opts naming.MountFlag) error {
+func (ns *neighborhoodService) Mount(ctx ipc.ServerContext, server string, ttlsecs uint32, opts naming.MountFlag) error {
+	return ns.MountX(ctx, server, nil, ttlsecs, opts)
+}
+func (ns *neighborhoodService) MountX(_ ipc.ServerContext, _ string, _ []security.BlessingPattern, _ uint32, _ naming.MountFlag) error {
 	return errors.New("this server does not implement Mount")
 }
 
diff --git a/services/mounttable/lib/neighborhood_test.go b/services/mounttable/lib/neighborhood_test.go
index 9d673a9..c9b8293 100644
--- a/services/mounttable/lib/neighborhood_test.go
+++ b/services/mounttable/lib/neighborhood_test.go
@@ -53,11 +53,11 @@
 	serverName := fmt.Sprintf("nhtest%d", os.Getpid())
 
 	// Add neighborhood server.
-	nhd, err := NewLoopbackNeighborhoodServer(serverName, addresses...)
+	nhd, err := NewLoopbackNeighborhoodDispatcher(serverName, addresses...)
 	if err != nil {
 		boom(t, "Failed to create neighborhood server: %s\n", err)
 	}
-	defer nhd.Stop()
+	defer nhd.(*neighborhood).Stop()
 	if err := server.ServeDispatcher("", nhd); err != nil {
 		boom(t, "Failed to register neighborhood server: %s", err)
 	}
diff --git a/services/mounttable/lib/serverlist.go b/services/mounttable/lib/serverlist.go
index 02c7308..f74752f 100644
--- a/services/mounttable/lib/serverlist.go
+++ b/services/mounttable/lib/serverlist.go
@@ -6,6 +6,7 @@
 	"time"
 
 	"v.io/core/veyron2/naming"
+	"v.io/core/veyron2/security"
 )
 
 type serverListClock interface {
@@ -24,8 +25,9 @@
 // server maintains the state of a single server.  Unless expires is refreshed before the
 // time is reached, the entry will be removed.
 type server struct {
-	expires time.Time
-	oa      string // object address of server
+	expires  time.Time
+	oa       string   // object address of server
+	patterns []string // patterns that match the blessings presented by the server.
 }
 
 // serverList represents an ordered list of servers.
@@ -34,8 +36,8 @@
 	l *list.List // contains entries of type *server
 }
 
-// NewServerList creates a synchronized list of servers.
-func NewServerList() *serverList {
+// newServerList creates a synchronized list of servers.
+func newServerList() *serverList {
 	return &serverList{l: list.New()}
 }
 
@@ -59,8 +61,12 @@
 // add to the front of the list if not already in the list, otherwise,
 // update the expiration time and move to the front of the list.  That
 // way the most recently refreshed is always first.
-func (sl *serverList) add(oa string, ttl time.Duration) {
+func (sl *serverList) add(oa string, patterns []security.BlessingPattern, ttl time.Duration) {
 	expires := slc.now().Add(ttl)
+	strpats := make([]string, len(patterns))
+	for idx, pat := range patterns {
+		strpats[idx] = string(pat)
+	}
 	sl.Lock()
 	defer sl.Unlock()
 	for e := sl.l.Front(); e != nil; e = e.Next() {
@@ -72,8 +78,9 @@
 		}
 	}
 	s := &server{
-		oa:      oa,
-		expires: expires,
+		oa:       oa,
+		expires:  expires,
+		patterns: strpats,
 	}
 	sl.l.PushFront(s) // innocent until proven guilty
 }
@@ -118,7 +125,7 @@
 	for e := sl.l.Front(); e != nil; e = e.Next() {
 		s := e.Value.(*server)
 		ttl := uint32(s.expires.Sub(now).Seconds())
-		ms := naming.VDLMountedServer{Server: s.oa, TTL: ttl}
+		ms := naming.VDLMountedServer{Server: s.oa, BlessingPatterns: s.patterns, TTL: ttl}
 		slice = append(slice, ms)
 	}
 	return slice
diff --git a/services/mounttable/lib/serverlist_test.go b/services/mounttable/lib/serverlist_test.go
index 66e31a4..7c1c135 100644
--- a/services/mounttable/lib/serverlist_test.go
+++ b/services/mounttable/lib/serverlist_test.go
@@ -1,8 +1,13 @@
 package mounttable
 
 import (
+	"fmt"
+	"reflect"
 	"testing"
 	"time"
+
+	"v.io/core/veyron2/naming"
+	"v.io/core/veyron2/security"
 )
 
 type fakeTime struct {
@@ -30,9 +35,10 @@
 	// Test adding entries.
 	ft := NewFakeTimeClock()
 	setServerListClock(ft)
-	sl := NewServerList()
+	sl := newServerList()
 	for i, ep := range eps {
-		sl.add(ep, time.Duration(5*i)*time.Second)
+		bp := security.BlessingPattern(fmt.Sprintf("ep%d", i))
+		sl.add(ep, []security.BlessingPattern{bp}, time.Duration(5*i)*time.Second)
 	}
 	if sl.len() != len(eps) {
 		t.Fatalf("got %d, want %d", sl.len(), len(eps))
@@ -49,4 +55,15 @@
 	if sl.len() != len(eps)-3 {
 		t.Fatalf("got %d, want %d", sl.len(), len(eps)-3)
 	}
+
+	// Test copyToSlice.
+	if got, want := sl.copyToSlice(), []naming.VDLMountedServer{
+		{
+			Server:           "endpoint:dfgsfdg@@",
+			TTL:              9,
+			BlessingPatterns: []string{"ep3"},
+		},
+	}; !reflect.DeepEqual(got, want) {
+		t.Errorf("Got %v, want %v", got, want)
+	}
 }
diff --git a/services/mounttable/mounttabled/mounttable.go b/services/mounttable/mounttabled/mounttable.go
index b6d60b9..c1d97bd 100644
--- a/services/mounttable/mounttabled/mounttable.go
+++ b/services/mounttable/mounttabled/mounttable.go
@@ -32,9 +32,9 @@
 		os.Exit(1)
 	}
 	defer mtServer.Stop()
-	mt, err := mounttable.NewMountTable(*aclFile)
+	mtd, err := mounttable.NewMountTableDispatcher(*aclFile)
 	if err != nil {
-		vlog.Errorf("r.NewMountTable failed: %v", err)
+		vlog.Errorf("r.NewMountTableDispatcher failed: %v", err)
 		os.Exit(1)
 	}
 	listenSpec := veyron2.GetListenSpec(ctx)
@@ -45,7 +45,7 @@
 	}
 	mtEndpoint := mtEndpoints[0]
 	name := *mountName
-	if err := mtServer.ServeDispatcher(name, mt); err != nil {
+	if err := mtServer.ServeDispatcher(name, mtd); err != nil {
 		vlog.Errorf("ServeDispatcher(%v) failed: %v", name, err)
 		os.Exit(1)
 	}
@@ -72,12 +72,12 @@
 
 		myObjectName := mtEndpoint.Name()
 
-		nh, err := mounttable.NewNeighborhoodServer(*nhName, myObjectName)
+		nhd, err := mounttable.NewNeighborhoodDispatcher(*nhName, myObjectName)
 		if err != nil {
 			vlog.Errorf("NewNeighborhoodServer failed: %v", err)
 			os.Exit(1)
 		}
-		if err := nhServer.ServeDispatcher(naming.JoinAddressName(myObjectName, "nh"), nh); err != nil {
+		if err := nhServer.ServeDispatcher(naming.JoinAddressName(myObjectName, "nh"), nhd); err != nil {
 			vlog.Errorf("nhServer.ServeDispatcher failed to register neighborhood: %v", err)
 			os.Exit(1)
 		}
diff --git a/tools/application/impl_test.go b/tools/application/impl_test.go
index 7b20e9f..e688c62 100644
--- a/tools/application/impl_test.go
+++ b/tools/application/impl_test.go
@@ -82,7 +82,7 @@
 type dispatcher struct {
 }
 
-func NewDispatcher() *dispatcher {
+func NewDispatcher() ipc.Dispatcher {
 	return &dispatcher{}
 }
 
diff --git a/tools/binary/impl_test.go b/tools/binary/impl_test.go
index 0bfe953..d0b1788 100644
--- a/tools/binary/impl_test.go
+++ b/tools/binary/impl_test.go
@@ -86,7 +86,7 @@
 type dispatcher struct {
 }
 
-func NewDispatcher() *dispatcher {
+func NewDispatcher() ipc.Dispatcher {
 	return &dispatcher{}
 }
 
diff --git a/tools/mgmt/device/impl/devicemanager_mock_test.go b/tools/mgmt/device/impl/devicemanager_mock_test.go
index 523c5e2..d0da827 100644
--- a/tools/mgmt/device/impl/devicemanager_mock_test.go
+++ b/tools/mgmt/device/impl/devicemanager_mock_test.go
@@ -200,7 +200,7 @@
 	t    *testing.T
 }
 
-func NewDispatcher(t *testing.T, tape *Tape) *dispatcher {
+func NewDispatcher(t *testing.T, tape *Tape) ipc.Dispatcher {
 	return &dispatcher{tape: tape, t: t}
 }
 
diff --git a/tools/mounttable/impl_test.go b/tools/mounttable/impl_test.go
index 43c650e..71de1c8 100644
--- a/tools/mounttable/impl_test.go
+++ b/tools/mounttable/impl_test.go
@@ -25,8 +25,8 @@
 func (s *server) Glob__(ctx ipc.ServerContext, pattern string) (<-chan naming.VDLMountEntry, error) {
 	vlog.VI(2).Infof("Glob() was called. suffix=%v pattern=%q", s.suffix, pattern)
 	ch := make(chan naming.VDLMountEntry, 2)
-	ch <- naming.VDLMountEntry{"name1", []naming.VDLMountedServer{{"server1", 123}}, false}
-	ch <- naming.VDLMountEntry{"name2", []naming.VDLMountedServer{{"server2", 456}, {"server3", 789}}, false}
+	ch <- naming.VDLMountEntry{"name1", []naming.VDLMountedServer{{"server1", nil, 123}}, false}
+	ch <- naming.VDLMountEntry{"name2", []naming.VDLMountedServer{{"server2", nil, 456}, {"server3", nil, 789}}, false}
 	close(ch)
 	return ch, nil
 }
@@ -36,6 +36,11 @@
 	return nil
 }
 
+func (s *server) MountX(_ ipc.ServerContext, server string, patterns []security.BlessingPattern, ttl uint32, flags naming.MountFlag) error {
+	vlog.VI(2).Infof("MountX() was called. suffix=%v servers=%q patterns=%v ttl=%d", s.suffix, server, patterns, ttl)
+	return nil
+}
+
 func (s *server) Unmount(_ ipc.ServerContext, server string) error {
 	vlog.VI(2).Infof("Unmount() was called. suffix=%v server=%q", s.suffix, server)
 	return nil
@@ -43,14 +48,14 @@
 
 func (s *server) ResolveStep(ipc.ServerContext) (entry naming.VDLMountEntry, err error) {
 	vlog.VI(2).Infof("ResolveStep() was called. suffix=%v", s.suffix)
-	entry.Servers = []naming.VDLMountedServer{{"server1", 123}}
+	entry.Servers = []naming.VDLMountedServer{{"server1", nil, 123}}
 	entry.Name = s.suffix
 	return
 }
 
 func (s *server) ResolveStepX(ipc.ServerContext) (entry naming.VDLMountEntry, err error) {
 	vlog.VI(2).Infof("ResolveStepX() was called. suffix=%v", s.suffix)
-	entry.Servers = []naming.VDLMountedServer{{"server1", 123}}
+	entry.Servers = []naming.VDLMountedServer{{"server1", nil, 123}}
 	entry.Name = s.suffix
 	return
 }
@@ -148,7 +153,7 @@
 	if err := cmd.Execute([]string{"resolvestep", naming.JoinAddressName(endpoint.String(), "name")}); err != nil {
 		t.Fatalf("%v", err)
 	}
-	if expected, got := `Servers: [{server1 123}] Suffix: "name" MT: false`, strings.TrimSpace(stdout.String()); got != expected {
+	if expected, got := `Servers: [{server1 [] 123}] Suffix: "name" MT: false`, strings.TrimSpace(stdout.String()); got != expected {
 		t.Errorf("Got %q, expected %q", got, expected)
 	}
 	stdout.Reset()
diff --git a/tools/naming/simulator/shell_functions.go b/tools/naming/simulator/shell_functions.go
index 5a8f899..ecbe56d 100644
--- a/tools/naming/simulator/shell_functions.go
+++ b/tools/naming/simulator/shell_functions.go
@@ -75,7 +75,7 @@
 		return err
 	}
 	disable := true
-	switch args[1] {
+	switch args[0] {
 	case "on":
 		disable = false
 	case "off":
@@ -116,5 +116,5 @@
 }
 
 func setNamespaceRoots(stdin io.Reader, stdout, stderr io.Writer, env map[string]string, args ...string) error {
-	return veyron2.GetNamespace(ctx).SetRoots(args[1:]...)
+	return veyron2.GetNamespace(ctx).SetRoots(args...)
 }
diff --git a/tools/naming/simulator/testdata/ambiguity.scr b/tools/naming/simulator/testdata/ambiguity.scr
index afa2c0a..a647015 100644
--- a/tools/naming/simulator/testdata/ambiguity.scr
+++ b/tools/naming/simulator/testdata/ambiguity.scr
@@ -21,19 +21,19 @@
 
 set localaddr="--veyron.tcp.address=127.0.0.1:0"
 
-root -- $localaddr
+root $localaddr
 set r=$_
 read $r
 eval $r
 set s1=$MT_NAME
 
-root  -- $localaddr
+root $localaddr
 set r=$_
 read $r
 eval $r
 set s2=$MT_NAME
 
-root -- $localaddr
+root $localaddr
 set r=$_
 read $r
 eval $r
@@ -45,7 +45,7 @@
 mount $s2/b $s3/c 1h
 wait $_
 
-echoServer  -- $localaddr "Echo" $s3/c
+echoServer $localaddr "Echo" $s3/c
 set es_h=$_
 
 # Returns the root and three mounts at s1/a.
diff --git a/tools/naming/simulator/testdata/echo.scr b/tools/naming/simulator/testdata/echo.scr
index fe4f59b..4ca7435 100644
--- a/tools/naming/simulator/testdata/echo.scr
+++ b/tools/naming/simulator/testdata/echo.scr
@@ -7,7 +7,7 @@
 setRoots
 
 # A 'stand-alone' server
-echoServer -- $localaddr $ws $localaddr "text" ""
+echoServer $localaddr $ws $localaddr "text" ""
 set es=$_
 read $es
 eval $es
@@ -22,14 +22,14 @@
 wait $ec
 
 # now use a nameserver.
-root -- $localaddr
+root $localaddr
 set r=$_
 read $r
 eval $r
 set root=$MT_NAME
 
 set NAMESPACE_ROOT=$root
-echoServer -- $localaddr $ws $localaddr "text2" "a/b"
+echoServer $localaddr $ws $localaddr "text2" "a/b"
 set es=$_
 read $es
 eval $es
diff --git a/tools/naming/simulator/testdata/json_example.scr b/tools/naming/simulator/testdata/json_example.scr
index e882725..d399a30 100644
--- a/tools/naming/simulator/testdata/json_example.scr
+++ b/tools/naming/simulator/testdata/json_example.scr
@@ -3,7 +3,7 @@
 
 set localaddr=--veyron.tcp.address=127.0.0.1:0
 
-root -- $localaddr
+root $localaddr
 set root=$_
 eval $root
 set ROOT_PID=$PID
@@ -12,7 +12,7 @@
 json_set ROOT_NAME ROOT_PID
 
 set PROXY_MOUNTPOINT=$ROOT_NAME/proxy/mp
-proxyd -- $localaddr $PROXY_MOUNTPOINT
+proxyd $localaddr $PROXY_MOUNTPOINT
 set proxyd=$_
 read $proxyd
 eval $proxyd
diff --git a/tools/naming/simulator/testdata/mt_complex.scr b/tools/naming/simulator/testdata/mt_complex.scr
index 620dbc1..e7761d3 100644
--- a/tools/naming/simulator/testdata/mt_complex.scr
+++ b/tools/naming/simulator/testdata/mt_complex.scr
@@ -7,21 +7,21 @@
 
 cache off
 
-root -- $localaddr
+root $localaddr
 set root_h=$_
 read $root_h
 eval $root_h
 set root=$MT_NAME
 
 set NAMESPACE_ROOT=$root
-mt -- $localaddr tl/a
+mt $localaddr tl/a
 set m=$_
 set mt_a_h=$m
 read $m
 eval $m
 set mt_a_name=$MT_NAME
 
-mt  -- $localaddr tl/b
+mt $localaddr tl/b
 set m=$_
 set mt_b_h=$m
 eval $m
@@ -73,7 +73,7 @@
 #
 
 # run an echo server on tl.
-echoServer  -- $localaddr "E1" tl
+echoServer  $localaddr "E1" tl
 set es_E1=$_
 read $es_E1
 eval $es_E1
@@ -126,7 +126,7 @@
 # run an echo server on tl/a - note that this currently doesn't seem to
 # have any effect on the mount table - that is, I suspect the mount table
 # refuses the mount.
-echoServer  -- $localaddr "E2" tl/a
+echoServer  $localaddr "E2" tl/a
 set es_E2=$_
 read $es_E2
 eval $es_E2
@@ -207,7 +207,7 @@
 
 # Create a mount table with a 'long' name
 set long_name=tl/b/some/deep/name/that/is/a/mount/table
-mt -- $localaddr $long_name
+mt $localaddr $long_name
 set m=$_
 read $m
 eval $m
@@ -216,14 +216,14 @@
 
 # Create a second mount table with a 'long' name
 set second_long_name=tl/a/some/deep/name/that/is/a/mount/table
-mt -- $localaddr $second_long_name
+mt $localaddr $second_long_name
 set m=$_
 read $m
 eval $m
 set mt_l2_name=$MT_NAME
 
 # Run an echo server that uses that mount table
-echoServer -- $localaddr "E3" $long_name/echo
+echoServer $localaddr "E3" $long_name/echo
 set es_E3=$_
 eval $es_E3
 set es_E3_name=$NAME
@@ -246,7 +246,7 @@
 mount tl/b/symlink $mt_b_name/$symlink_target 1h M
 wait $_
 
-ls -- -l tl/b/symlink
+ls -l tl/b/symlink
 wait $_
 
 resolve tl/b/symlink
diff --git a/tools/naming/simulator/testdata/mt_simple.scr b/tools/naming/simulator/testdata/mt_simple.scr
index ef648ec..9c5b5f2 100644
--- a/tools/naming/simulator/testdata/mt_simple.scr
+++ b/tools/naming/simulator/testdata/mt_simple.scr
@@ -3,19 +3,19 @@
 set localaddr="--veyron.tcp.address=127.0.0.1:0"
 set ws=--veyron.tcp.protocol=ws
 
-root -- $localaddr
+root $localaddr
 set m=$_
 read $m
 eval $m
 set root=$MT_NAME
 
 set NAMESPACE_ROOT=$root
-mt -- $localaddr $ws $localaddr usa
+mt $localaddr $ws $localaddr usa
 set m=$_
 read $m
 eval $m
 set usa_mt=$MT_NAME
-mt -- $localaddr $ws $localaddr uk
+mt $localaddr $ws $localaddr uk
 set m=$_
 read $m
 eval $m
@@ -28,14 +28,14 @@
 wait $l
 
 set NAMESPACE_ROOT=$usa_mt
-mt -- $localaddr $ws $localaddr "palo alto"
+mt $localaddr $ws $localaddr "palo alto"
 set m=$_
 read $m
 eval $m
 set pa_mt=$MT_NAME
 
 set NAMESPACE_ROOT=$uk_mt
-mt -- $localaddr $ws $localaddr "cambridge"
+mt $localaddr $ws $localaddr "cambridge"
 set m=$_
 read $m
 eval $m
@@ -47,7 +47,7 @@
 assert $RN 7
 wait $l
 
-ls -- -l $root/...
+ls -l $root/...
 wait $_
 
 resolve $root/usa
diff --git a/tools/naming/simulator/testdata/proxy.scr b/tools/naming/simulator/testdata/proxy.scr
index cb0d6bc..855879e 100644
--- a/tools/naming/simulator/testdata/proxy.scr
+++ b/tools/naming/simulator/testdata/proxy.scr
@@ -3,7 +3,7 @@
 set localaddr=--veyron.tcp.address=127.0.0.1:0
 set ws=--veyron.tcp.protocol=ws
 
-root -- $localaddr
+root $localaddr
 set m=$_
 read $m
 eval $m
@@ -13,7 +13,7 @@
 print $NAMESPACE_ROOT
 
 # run a non-proxied echo server
-echoServer -- $localaddr $ws $localaddr noproxy echo/noproxy
+echoServer $localaddr $ws $localaddr noproxy echo/noproxy
 set esnp=$_
 read $esnp
 eval $esnp
@@ -25,7 +25,7 @@
 assert $l "noproxy: ohh"
 
 # run a proxy server
-proxyd -- $localaddr $ws $localaddr p1
+proxyd $localaddr $ws $localaddr p1
 set proxy=$_
 read $proxy
 # PROXY_NAME=<name of proxy>
@@ -44,7 +44,7 @@
 #assert $RN 3
 #wait $l
 
-echoServer -- $localaddr $ws $localaddr --veyron.proxy=p1 withproxy echo/withproxy
+echoServer $localaddr $ws $localaddr --veyron.proxy=p1 withproxy echo/withproxy
 set eswp=$_
 read $eswp
 eval $eswp
@@ -104,9 +104,9 @@
 # $ep4_addr
 assert $rid $ECHOS_RID
 
-ls -- -l echo/withproxy
+ls -l echo/withproxy
 wait $_
-ls -- -l echo/noproxy
+ls -l echo/noproxy
 wait $_
 
 echoClient echo/withproxy "ohh"
diff --git a/tools/naming/simulator/testdata/public_echo.scr b/tools/naming/simulator/testdata/public_echo.scr
index 4e508e9..5447fad 100644
--- a/tools/naming/simulator/testdata/public_echo.scr
+++ b/tools/naming/simulator/testdata/public_echo.scr
@@ -9,7 +9,7 @@
 # now use the global nameserver.
 
 set global_name=global/echo
-echoServer -- $localaddr "text2" $global_name
+echoServer $localaddr "text2" $global_name
 set es=$_
 read $es
 eval $es
diff --git a/tools/profile/impl_test.go b/tools/profile/impl_test.go
index f334e31..8ae4621 100644
--- a/tools/profile/impl_test.go
+++ b/tools/profile/impl_test.go
@@ -76,7 +76,7 @@
 type dispatcher struct {
 }
 
-func NewDispatcher() *dispatcher {
+func NewDispatcher() ipc.Dispatcher {
 	return &dispatcher{}
 }