r11446: Remove unused fn. Remove unneeded strncpy use.
authorJeremy Allison <jra@samba.org>
Tue, 1 Nov 2005 23:29:02 +0000 (23:29 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:05:16 +0000 (11:05 -0500)
Jeremy.
(This used to be commit d202aae3c821f3d78ff063d867bac1f84dca3548)

source3/lib/util.c
source3/rpc_parse/parse_prs.c

index 6b97491039a038c980579421069c290871ec93b1..677871e2d061a99ccf0cee48386a99a81bffcf9e 100644 (file)
@@ -1356,12 +1356,8 @@ char *automount_lookup(const char *user_name)
        } else {
                if ((nis_error = yp_match(nis_domain, nis_map, user_name, strlen(user_name),
                                &nis_result, &nis_result_len)) == 0) {
-                       if (!nis_error && nis_result_len >= sizeof(pstring)) {
-                               nis_result_len = sizeof(pstring)-1;
-                       }
                        fstrcpy(last_key, user_name);
-                       strncpy(last_value, nis_result, nis_result_len);
-                       last_value[nis_result_len] = '\0';
+                       pstrcpy(last_value, nis_result);
                        strip_mount_options(&last_value);
 
                } else if(nis_error == YPERR_KEY) {
@@ -1682,8 +1678,7 @@ BOOL is_in_path(const char *name, name_compare_entry *namelist, BOOL case_sensit
 
        /* Get the last component of the unix name. */
        p = strrchr_m(name, '/');
-       strncpy(last_component, p ? ++p : name, sizeof(last_component)-1);
-       last_component[sizeof(last_component)-1] = '\0'; 
+       pstrcpy(last_component, p ? ++p : name);
 
        for(; namelist->name != NULL; namelist++) {
                if(namelist->is_wild) {
index 3742ac95bed85266bd552637a070d7eaa97e4542..77f0e6d5c8865b8ff0afae4e59ac2d51536be6d6 100644 (file)
@@ -1274,32 +1274,6 @@ BOOL prs_string(const char *name, prs_struct *ps, int depth, char *str, int max_
        return True;
 }
 
-BOOL prs_string_alloc(const char *name, prs_struct *ps, int depth,
-                     const char **str)
-{
-       size_t len;
-       char *tmp_str;
-
-       if (UNMARSHALLING(ps))
-               len = strlen(&ps->data_p[ps->data_offset]);
-       else
-               len = strlen(*str);
-
-       tmp_str = PRS_ALLOC_MEM(ps, char, len+1);
-
-       if (tmp_str == NULL)
-               return False;
-
-       if (MARSHALLING(ps))
-               strncpy(tmp_str, *str, len);
-
-       if (!prs_string(name, ps, depth, tmp_str, len+1))
-               return False;
-
-       *str = tmp_str;
-       return True;
-}
-
 /*******************************************************************
  prs_uint16 wrapper. Call this and it sets up a pointer to where the
  uint16 should be stored, or gets the size if reading.