* can be more than one backend with the same name, as long as they
* have different typesx */
static struct {
- struct ntvfs_ops *ops;
+ const struct ntvfs_ops *ops;
} *backends = NULL;
static int num_backends;
*/
static NTSTATUS ntvfs_register(void *_ops)
{
- struct ntvfs_ops *ops = _ops;
+ const struct ntvfs_ops *ops = _ops;
+ struct ntvfs_ops *new_ops;
if (ntvfs_backend_byname(ops->name, ops->type) != NULL) {
/* its already registered! */
- DEBUG(2,("NTVFS backend '%s' for type %d already registered\n",
+ DEBUG(0,("NTVFS backend '%s' for type %d already registered\n",
ops->name, (int)ops->type));
return NT_STATUS_OBJECT_NAME_COLLISION;
}
smb_panic("out of memory in ntvfs_register");
}
- backends[num_backends].ops = smb_xmemdup(ops, sizeof(*ops));
- backends[num_backends].ops->name = smb_xstrdup(ops->name);
+ new_ops = smb_xmemdup(ops, sizeof(*ops));
+ new_ops->name = smb_xstrdup(ops->name);
+
+ backends[num_backends].ops = new_ops;
num_backends++;
+ DEBUG(3,("NTVFS backend '%s' for type %d registered\n",
+ ops->name,ops->type));
+
return NT_STATUS_OK;
}
/*
return the operations structure for a named backend of the specified type
*/
-struct ntvfs_ops *ntvfs_backend_byname(const char *name, enum ntvfs_type type)
+const struct ntvfs_ops *ntvfs_backend_byname(const char *name, enum ntvfs_type type)
{
int i;
NTVFS_INTERFACE_VERSION,
sizeof(struct ntvfs_ops),
sizeof(SMB_OFF_T),
- sizeof(struct tcon_context),
+ sizeof(struct smbsrv_tcon),
sizeof(struct request_context),
};
*/
NTSTATUS ntvfs_init_connection(struct request_context *req)
{
- const char *handler = lp_ntvfs_handler(req->conn->service);
-
- if (strequal(handler, "default"))
- handler = "ipc";
+ const char *handler = lp_ntvfs_handler(req->tcon->service);
- req->conn->ntvfs_ops = ntvfs_backend_byname(handler, req->conn->type);
+ req->tcon->ntvfs_ops = ntvfs_backend_byname(handler, req->tcon->type);
- if (!req->conn->ntvfs_ops) {
- DEBUG(1,("ntvfs_init_connection: failed to find backend=%s, type=%d\n", handler, req->conn->type));
+ if (!req->tcon->ntvfs_ops) {
+ DEBUG(1,("ntvfs_init_connection: failed to find backend=%s, type=%d\n", handler, req->tcon->type));
return NT_STATUS_UNSUCCESSFUL;
}