]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
libcli/smb: move smb2_util_lease_state() to libcli/smb/util.c
authorRalph Boehme <slow@samba.org>
Fri, 28 Nov 2025 09:57:23 +0000 (10:57 +0100)
committerRalph Boehme <slow@samba.org>
Fri, 17 Jul 2026 10:18:36 +0000 (10:18 +0000)
While at it, get rid of the strlen(), we don't need it.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
libcli/smb/smb_util.h
libcli/smb/util.c
source4/torture/smb2/util.c

index c3533a2d2e1a74ecbe175364ce3df8272267e4b6..dcbb92f3e07eb963de9306c8477325e98a14a29b 100644 (file)
@@ -78,4 +78,6 @@ struct smb_transports {
 struct smb_transports smb_transports_parse(const char *param_name,
                                           const char * const *transports);
 
+uint32_t smb2_util_lease_state(const char *ls);
+
 #endif /* _SMB_UTIL_H */
index e92acccf47a3c17a18aa362786f8cb96a128b0bf..909fdd27b16a24ba6ab98ff63d472c461a87cb79 100644 (file)
@@ -783,3 +783,25 @@ struct smb_transports smb_transports_parse(const char *param_name,
 
        return ts;
 }
+
+uint32_t smb2_util_lease_state(const char *ls)
+{
+       uint32_t val = 0;
+       int i;
+
+       for (i = 0; ls[i] != '\0'; i++) {
+               switch (ls[i]) {
+               case 'R':
+                       val |= SMB2_LEASE_READ;
+                       break;
+               case 'H':
+                       val |= SMB2_LEASE_HANDLE;
+                       break;
+               case 'W':
+                       val |= SMB2_LEASE_WRITE;
+                       break;
+               }
+       }
+
+       return val;
+}
index 22b11e425b6b09f867a959073a93a3afdfdc973d..7c8b839433c79974fff2971893b5ad2e6ac02bfd 100644 (file)
@@ -801,29 +801,6 @@ bool smb2_util_verify_attrib(TALLOC_CTX *tctx, struct smb2_tree *tree,
        return ret;
 }
 
-
-uint32_t smb2_util_lease_state(const char *ls)
-{
-       uint32_t val = 0;
-       int i;
-
-       for (i = 0; i < strlen(ls); i++) {
-               switch (ls[i]) {
-               case 'R':
-                       val |= SMB2_LEASE_READ;
-                       break;
-               case 'H':
-                       val |= SMB2_LEASE_HANDLE;
-                       break;
-               case 'W':
-                       val |= SMB2_LEASE_WRITE;
-                       break;
-               }
-       }
-
-       return val;
-}
-
 char *smb2_util_lease_state_string(TALLOC_CTX *mem_ctx, uint32_t ls)
 {
        return talloc_asprintf(mem_ctx, "0x%0x (%s%s%s)",