]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
C26: update function signatures for const-correctness
authorStefan Metzmacher <metze@samba.org>
Mon, 30 Mar 2026 15:17:47 +0000 (17:17 +0200)
committerStefan Metzmacher <metze@samba.org>
Thu, 21 May 2026 17:25:33 +0000 (17:25 +0000)
Update function return types and parameter types to propagate const-correctness
through APIs affected by the C26 strchr/strstr changes.

Pair-Programmed-With: Andreas Schneider <asn@samba.org>

BUG: https://bugzilla.samba.org/show_bug.cgi?id=16006

Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
source3/libads/ads_proto.h
source3/libads/ldap.c
source3/param/loadparm.h
source3/param/util.c
third_party/resolv_wrapper/resolv_wrapper.c

index a368e04d7e49b1374ac79f2a49c2316d936fadc8..53a7b0b890d5e6d76017268c01334e31a2843b83 100644 (file)
@@ -89,7 +89,7 @@ ADS_STATUS ads_do_search_all_fn(ADS_STRUCT *ads, const char *bind_path,
                                int scope, const char *expr, const char **attrs,
                                bool (*fn)(ADS_STRUCT *, char *, void **, void *),
                                void *data_area);
-char *ads_parent_dn(const char *dn);
+const char *ads_parent_dn(const char *dn);
 ADS_MODLIST ads_init_mods(TALLOC_CTX *ctx);
 ADS_STATUS ads_mod_str(TALLOC_CTX *ctx, ADS_MODLIST *mods,
                       const char *name, const char *val);
index cc1715d151d942735607fab823b0243b2476dc1c..6e8798bc069712679ab630bf00c18d25b32f4e1f 100644 (file)
@@ -1851,9 +1851,9 @@ ADS_STATUS ads_do_search_all_fn(ADS_STRUCT *ads, const char *bind_path,
  * @param dn the dn to return the parent from
  * @return parent dn string
  **/
-char *ads_parent_dn(const char *dn)
+const char *ads_parent_dn(const char *dn)
 {
-       char *p;
+       const char *p = NULL;
 
        if (dn == NULL) {
                return NULL;
@@ -2932,7 +2932,7 @@ ADS_STATUS ads_move_machine_acct(ADS_STRUCT *ads, const char *machine_name,
        LDAPMessage *res = NULL;
        char *filter = NULL;
        char *computer_dn = NULL;
-       char *parent_dn;
+       const char *parent_dn = NULL;
        char *computer_rdn = NULL;
        bool need_move = False;
 
index 43f6c61804deb144132979395600c52bea99cb25..b1cb3695498b110c9ce15a819dc523cf4e70717d 100644 (file)
@@ -213,6 +213,6 @@ void set_server_role(void);
 /* The following definitions come from param/util.c  */
 
 uint32_t get_int_param( const char* param );
-char *get_string_param( const char* param );
+const char *get_string_param( const char* param );
 
 #endif /* _S3_LOADPARM_H */
index d4aaee197866700468383b78b78148283ab83b87..e909b70c3e64c8007bef04669fd78c5880cc276e 100644 (file)
@@ -38,9 +38,9 @@ uint32_t get_int_param( const char* param )
  utility function to parse an integer parameter from
  "parameter = value"
 **********************************************************/
-char* get_string_param( const char* param )
+const char* get_string_param( const char* param )
 {
-       char *p;
+       const char *p = NULL;
 
        p = strchr( param, '=' );
        if ( !p )
index 899f4ccc7a97ce55ad9dcc00f75ac480db85f3ae..1656dfabf4d8f3c2dcb258a96e87b8fe12caa2c8 100644 (file)
@@ -285,13 +285,13 @@ static int rwrap_create_fake_ns_rr(const char *key,
 }
 
 static int rwrap_create_fake_srv_rr(const char *key,
-                                   const char *value,
+                                   char *value,
                                    struct rwrap_fake_rr *rr)
 {
        char *str_prio;
        char *str_weight;
        char *str_port;
-       const char *hostname;
+       char *hostname;
 
        /* parse the value into priority, weight, port and hostname
         * and check the validity */
@@ -324,12 +324,12 @@ static int rwrap_create_fake_srv_rr(const char *key,
 }
 
 static int rwrap_create_fake_uri_rr(const char *key,
-                                   const char *value,
+                                   char *value,
                                    struct rwrap_fake_rr *rr)
 {
        char *str_prio;
        char *str_weight;
-       const char *uri;
+       char *uri;
 
        /* parse the value into priority, weight, and uri
         * and check the validity */
@@ -371,10 +371,10 @@ static int rwrap_create_fake_txt_rr(const char *key,
 }
 
 static int rwrap_create_fake_soa_rr(const char *key,
-                                   const char *value,
+                                   char *value,
                                    struct rwrap_fake_rr *rr)
 {
-       const char *nameserver;
+       char *nameserver;
        char *mailbox;
        char *str_serial;
        char *str_refresh;