The branch, master has been updated
       via  6490ff63552 s3:lib: Give better warnings about corrupted 
AppleDobule files
       via  a269ab4a9b5 s3:lib: Move ad_unpack() debug message to notice level
      from  e38f864017a gitlab-ci: Update Fedora to version 38

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 6490ff635521295b1f55f697f1950e1721d543ca
Author: Andreas Schneider <a...@samba.org>
Date:   Wed Apr 26 08:40:29 2023 +0200

    s3:lib: Give better warnings about corrupted AppleDobule files
    
    Signed-off-by: Andreas Schneider <a...@samba.org>
    Reviewed-by: Andrew Bartlett <abart...@samba.org>
    
    Autobuild-User(master): Andreas Schneider <a...@cryptomilk.org>
    Autobuild-Date(master): Thu Apr 27 09:25:50 UTC 2023 on atb-devel-224

commit a269ab4a9b5c75e41ecb0cba4cfd13d1f1aa2737
Author: Andreas Schneider <a...@samba.org>
Date:   Wed Apr 26 08:30:38 2023 +0200

    s3:lib: Move ad_unpack() debug message to notice level
    
    We should give a good warning message one level above.
    
    Signed-off-by: Andreas Schneider <a...@samba.org>
    Reviewed-by: Andrew Bartlett <abart...@samba.org>

-----------------------------------------------------------------------

Summary of changes:
 source3/lib/adouble.c | 72 +++++++++++++++++++++++++++++++++------------------
 1 file changed, 47 insertions(+), 25 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/lib/adouble.c b/source3/lib/adouble.c
index 062c73ec758..81229310c13 100644
--- a/source3/lib/adouble.c
+++ b/source3/lib/adouble.c
@@ -967,14 +967,14 @@ static bool ad_unpack(struct adouble *ad, const size_t 
nentries,
         */
 
        if (bufsize < (AD_HEADER_LEN + (AD_ENTRY_LEN * nentries))) {
-               DEBUG(1, ("bad size\n"));
+               DBG_NOTICE("Bad size\n");
                return false;
        }
 
        ad->ad_magic = RIVAL(ad->ad_data, 0);
        ad->ad_version = RIVAL(ad->ad_data, ADEDOFF_VERSION);
        if ((ad->ad_magic != AD_MAGIC) || (ad->ad_version != AD_VERSION)) {
-               DEBUG(1, ("wrong magic or version\n"));
+               DBG_NOTICE("Wrong magic or version\n");
                return false;
        }
 
@@ -982,8 +982,7 @@ static bool ad_unpack(struct adouble *ad, const size_t 
nentries,
 
        adentries = RSVAL(ad->ad_data, ADEDOFF_NENTRIES);
        if (adentries != nentries) {
-               DEBUG(1, ("invalid number of entries: %zu\n",
-                         adentries));
+               DBG_NOTICE("Invalid number of entries: %zu\n", adentries);
                return false;
        }
 
@@ -995,7 +994,7 @@ static bool ad_unpack(struct adouble *ad, const size_t 
nentries,
                len = RIVAL(ad->ad_data, AD_HEADER_LEN + (i * AD_ENTRY_LEN) + 
8);
 
                if (!eid || eid >= ADEID_MAX) {
-                       DEBUG(1, ("bogus eid %d\n", eid));
+                       DBG_NOTICE("Bogus eid %d\n", eid);
                        return false;
                }
 
@@ -1005,16 +1004,22 @@ static bool ad_unpack(struct adouble *ad, const size_t 
nentries,
                 * ensure the specified offset is within that bound
                 */
                if ((off > bufsize) && (eid != ADEID_RFORK)) {
-                       DEBUG(1, ("bogus eid %d: off: %" PRIu32 ", len: %" 
PRIu32 "\n",
-                                 eid, off, len));
+                       DBG_NOTICE("Fogus eid %d: off: %" PRIu32
+                                  ", len: %" PRIu32 "\n",
+                                  eid,
+                                  off,
+                                  len);
                        return false;
                }
 
                ok = ad_entry_check_size(eid, bufsize, off, len);
                if (!ok) {
-                       DBG_ERR("bogus eid [%"PRIu32"] bufsize [%zu] "
-                               "off [%"PRIu32"] len [%"PRIu32"]\n",
-                               eid, bufsize, off, len);
+                       DBG_NOTICE("bogus eid [%" PRIu32 "] bufsize [%zu] "
+                                  "off [%" PRIu32 "] len [%" PRIu32 "]\n",
+                                  eid,
+                                  bufsize,
+                                  off,
+                                  len);
                        return false;
                }
 
@@ -1022,8 +1027,11 @@ static bool ad_unpack(struct adouble *ad, const size_t 
nentries,
                 * That would be obviously broken
                 */
                if (off > filesize) {
-                       DEBUG(1, ("bogus eid %d: off: %" PRIu32 ", len: %" 
PRIu32 "\n",
-                                 eid, off, len));
+                       DBG_NOTICE("Bogus eid %d: off: %" PRIu32
+                                  ", len: %" PRIu32 "\n",
+                                  eid,
+                                  off,
+                                  len);
                        return false;
                }
 
@@ -1032,9 +1040,11 @@ static bool ad_unpack(struct adouble *ad, const size_t 
nentries,
                 * filesize.
                 */
                if (off + len < off) {
-                       DEBUG(1, ("offset wrap in eid %d: off: %" PRIu32
-                                 ", len: %" PRIu32 "\n",
-                                 eid, off, len));
+                       DBG_NOTICE("offset wrap in eid %d: off: %" PRIu32
+                                  ", len: %" PRIu32 "\n",
+                                  eid,
+                                  off,
+                                  len);
                        return false;
 
                }
@@ -1045,9 +1055,11 @@ static bool ad_unpack(struct adouble *ad, const size_t 
nentries,
                         * out.
                         */
                        if (eid != ADEID_RFORK) {
-                               DEBUG(1, ("bogus eid %d: off: %" PRIu32
-                                         ", len: %" PRIu32 "\n",
-                                         eid, off, len));
+                               DBG_NOTICE("Bogus eid %d: off: %" PRIu32
+                                          ", len: %" PRIu32 "\n",
+                                          eid,
+                                          off,
+                                          len);
                                return false;
                        }
 
@@ -1056,8 +1068,10 @@ static bool ad_unpack(struct adouble *ad, const size_t 
nentries,
                         * the size to entryoffset - filesize.
                         */
                        len = filesize - off;
-                       DEBUG(1, ("Limiting ADEID_RFORK: off: %" PRIu32
-                                 ", len: %" PRIu32 "\n", off, len));
+                       DBG_NOTICE("Limiting ADEID_RFORK: off: %" PRIu32
+                                  ", len: %" PRIu32 "\n",
+                                  off,
+                                  len);
                }
 
                ad->ad_eid[eid].ade_off = off;
@@ -2151,7 +2165,11 @@ static ssize_t ad_read_meta(vfs_handle_struct *handle,
        /* Now parse entries */
        ok = ad_unpack(ad, ADEID_NUM_XATTR, AD_DATASZ_XATTR);
        if (!ok) {
-               DEBUG(2, ("invalid AppleDouble metadata xattr\n"));
+               DBG_WARNING(
+                       "Invalid AppleDouble xattr metadata (%s) in file: %s - "
+                       "Consider deleting the corrupted file.\n",
+                       smb_fname->base_name,
+                       ad->ad_fsp->fsp_name->base_name);
                errno = EINVAL;
                rc = -1;
                goto exit;
@@ -2360,8 +2378,10 @@ static ssize_t ad_read_rsrc_adouble(vfs_handle_struct 
*handle,
                       ADEID_NUM_DOT_UND,
                       ad->ad_fsp->fsp_name->st.st_ex_size);
        if (!ok) {
-               DBG_ERR("invalid AppleDouble resource %s\n",
-                       smb_fname->base_name);
+               DBG_WARNING("Invalid AppleDouble resource (%s) in file: %s - "
+                           "Consider deleting the corrupted file.\n",
+                           smb_fname->base_name,
+                           ad->ad_fsp->fsp_name->base_name);
                errno = EINVAL;
                return -1;
        }
@@ -2370,8 +2390,10 @@ static ssize_t ad_read_rsrc_adouble(vfs_handle_struct 
*handle,
            || (ad_getentrylen(ad, ADEID_FINDERI) < ADEDLEN_FINDERI)
            || (ad_getentryoff(ad, ADEID_RFORK) < ADEDOFF_RFORK_DOT_UND))
        {
-               DBG_ERR("invalid AppleDouble resource %s\n",
-                       smb_fname->base_name);
+               DBG_WARNING("Invalid AppleDouble resource (%s) in file: %s - "
+                           "Consider deleting the corrupted file.\n",
+                           smb_fname->base_name,
+                           ad->ad_fsp->fsp_name->base_name);
                errno = EINVAL;
                return -1;
        }


-- 
Samba Shared Repository

Reply via email to