s3-util: move valid_share_pathname() to lib/util.c
authorGünther Deschner <gd@samba.org>
Fri, 29 Apr 2011 20:34:56 +0000 (22:34 +0200)
committerGünther Deschner <gd@samba.org>
Mon, 2 May 2011 13:03:43 +0000 (15:03 +0200)
Guenther

source3/include/proto.h
source3/lib/util.c
source3/rpc_server/srvsvc/srv_srvsvc_nt.c

index 5ff1c056ceb1fedb9fc2ff68c452d38df2eb4f34..aee1da9768288173a4ebac842a7d46e879e42295 100644 (file)
@@ -736,6 +736,7 @@ bool tevent_req_poll_ntstatus(struct tevent_req *req,
                              NTSTATUS *status);
 bool any_nt_status_not_ok(NTSTATUS err1, NTSTATUS err2, NTSTATUS *result);
 int timeval_to_msec(struct timeval t);
+char *valid_share_pathname(TALLOC_CTX *ctx, const char *dos_pathname);
 
 /* The following definitions come from lib/util_cmdline.c  */
 
@@ -2667,10 +2668,6 @@ void do_drv_upgrade_printer(struct messaging_context *msg,
                            DATA_BLOB *data);
 void update_monitored_printq_cache(struct messaging_context *msg_ctx);
 
-/* The following definitions come from rpc_server/srv_srvsvc_nt.c  */
-
-char *valid_share_pathname(TALLOC_CTX *ctx, const char *dos_pathname);
-
 /* The following definitions come from rpc_server/srv_svcctl_nt.c  */
 
 bool init_service_op_table( void );
index 8805197f2d8297a59072c9328534a0ebb0773730..718500a684fd2517ad9a6269eed3344b335e68bc 100644 (file)
@@ -2652,3 +2652,37 @@ int timeval_to_msec(struct timeval t)
 {
        return t.tv_sec * 1000 + (t.tv_usec+999) / 1000;
 }
+
+/*******************************************************************
+ Check a given DOS pathname is valid for a share.
+********************************************************************/
+
+char *valid_share_pathname(TALLOC_CTX *ctx, const char *dos_pathname)
+{
+       char *ptr = NULL;
+
+       if (!dos_pathname) {
+               return NULL;
+       }
+
+       ptr = talloc_strdup(ctx, dos_pathname);
+       if (!ptr) {
+               return NULL;
+       }
+       /* Convert any '\' paths to '/' */
+       unix_format(ptr);
+       ptr = unix_clean_name(ctx, ptr);
+       if (!ptr) {
+               return NULL;
+       }
+
+       /* NT is braindead - it wants a C: prefix to a pathname ! So strip it. */
+       if (strlen(ptr) > 2 && ptr[1] == ':' && ptr[0] != '/')
+               ptr += 2;
+
+       /* Only absolute paths allowed. */
+       if (*ptr != '/')
+               return NULL;
+
+       return ptr;
+}
index e51fee89c61a328b220a3499dade47113fb424aa..36f4c18226b82cb45d206316b6df250d4f947a0e 100644 (file)
@@ -1512,40 +1512,6 @@ WERROR _srvsvc_NetShareGetInfo(struct pipes_struct *p,
        return status;
 }
 
-/*******************************************************************
- Check a given DOS pathname is valid for a share.
-********************************************************************/
-
-char *valid_share_pathname(TALLOC_CTX *ctx, const char *dos_pathname)
-{
-       char *ptr = NULL;
-
-       if (!dos_pathname) {
-               return NULL;
-       }
-
-       ptr = talloc_strdup(ctx, dos_pathname);
-       if (!ptr) {
-               return NULL;
-       }
-       /* Convert any '\' paths to '/' */
-       unix_format(ptr);
-       ptr = unix_clean_name(ctx, ptr);
-       if (!ptr) {
-               return NULL;
-       }
-
-       /* NT is braindead - it wants a C: prefix to a pathname ! So strip it. */
-       if (strlen(ptr) > 2 && ptr[1] == ':' && ptr[0] != '/')
-               ptr += 2;
-
-       /* Only absolute paths allowed. */
-       if (*ptr != '/')
-               return NULL;
-
-       return ptr;
-}
-
 /*******************************************************************
  _srvsvc_NetShareSetInfo. Modify share details.
 ********************************************************************/