fss: return netbios name instead of IP in responses
authorDavid Disseldorp <ddiss@samba.org>
Sun, 5 May 2013 16:50:13 +0000 (18:50 +0200)
committerDavid Disseldorp <ddiss@samba.org>
Wed, 8 May 2013 10:21:38 +0000 (12:21 +0200)
IsPathSupported() and GetShareMapping() responses include the server
machine name and snapshot UNC respectively. Until now the server IP
address has been used, lp_netbios_name() should be used instead.

source3/rpc_server/fss/srv_fss_agent.c

index 14829ccc1d1ea409d3b54dc8547a80f2041bd0b0..9be847e849d037b2e2474c19d7df6e6ab2bc82d6 100644 (file)
@@ -1159,7 +1159,6 @@ uint32_t _fss_IsPathSupported(struct pipes_struct *p,
        NTSTATUS status;
        struct connection_struct *conn;
        char *share;
-       char *addr;
        TALLOC_CTX *tmp_ctx = talloc_new(p->mem_ctx);
        if (tmp_ctx == NULL) {
                return E_OUTOFMEMORY;
@@ -1205,12 +1204,7 @@ uint32_t _fss_IsPathSupported(struct pipes_struct *p,
                return FSRVP_E_NOT_SUPPORTED;
        }
 
-       addr = tsocket_address_inet_addr_string(p->local_address, p->mem_ctx);
-       if (addr == NULL) {
-               talloc_free(tmp_ctx);
-               return E_OUTOFMEMORY;
-       }
-       *r->out.OwnerMachineName = addr;
+       *r->out.OwnerMachineName = lp_netbios_name();
        *r->out.SupportedByThisProvider = 1;
        talloc_free(tmp_ctx);
        return 0;
@@ -1234,7 +1228,6 @@ uint32_t _fss_GetShareMapping(struct pipes_struct *p,
        struct fss_sc_set *sc_set;
        struct fss_sc *sc;
        struct fss_sc_smap *sc_smap;
-       char *addr;
        char *share;
        struct fssagent_share_mapping_1 *sm_out;
 
@@ -1276,17 +1269,22 @@ uint32_t _fss_GetShareMapping(struct pipes_struct *p,
                talloc_free(tmp_ctx);
                return E_INVALIDARG;
        }
-       addr = tsocket_address_inet_addr_string(p->local_address, p->mem_ctx);
-       if (addr == NULL) {
+
+       sm_out = talloc_zero(p->mem_ctx, struct fssagent_share_mapping_1);
+       if (sm_out == NULL) {
                talloc_free(tmp_ctx);
                return E_OUTOFMEMORY;
        }
-
-       sm_out = talloc_zero(p->mem_ctx, struct fssagent_share_mapping_1);
        sm_out->ShadowCopySetId = sc_set->id;
        sm_out->ShadowCopyId = sc->id;
-       sm_out->ShareNameUNC = talloc_asprintf(p->mem_ctx, "\\\\%s\\%s",
-                                              addr, sc_smap->share_name);
+       sm_out->ShareNameUNC = talloc_asprintf(sm_out, "\\\\%s\\%s",
+                                              lp_netbios_name(),
+                                              sc_smap->share_name);
+       if (sm_out->ShareNameUNC == NULL) {
+               talloc_free(sm_out);
+               talloc_free(tmp_ctx);
+               return E_OUTOFMEMORY;
+       }
        sm_out->ShadowCopyShareName = sc_smap->sc_share_name;
        unix_to_nt_time(&sm_out->tstamp, sc->create_ts);
        r->out.ShareMapping->ShareMapping1 = sm_out;