Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for validatePath (1.11 sec)

  1. src/test/java/jcifs/util/PathValidatorTest.java

            // Test trailing slash removal
            assertEquals("\\share\\folder", validator.validatePath("\\share\\folder\\"));
        }
    
        @Test
        public void testDirectoryTraversal() throws Exception {
            assertThrows(SmbException.class, () -> {
                validator.validatePath("\\share\\..\\..\\windows\\system32");
            });
        }
    
        @Test
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Sat Aug 30 05:58:03 UTC 2025
    - 14.6K bytes
    - Viewed (0)
  2. src/test/java/jcifs/util/ServerResponseValidatorTest.java

        }
    
        @Test
        public void testValidPath() throws Exception {
            validator.validatePath("\\share\\folder\\file.txt");
            validator.validatePath("C:\\Windows\\System32");
            validator.validatePath(null); // Null should be allowed
            validator.validatePath(""); // Empty should be allowed
        }
    
        @Test
        public void testPathTooLong() throws Exception {
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Sat Aug 30 05:58:03 UTC 2025
    - 14.2K bytes
    - Viewed (0)
  3. src/main/java/jcifs/util/PathValidator.java

        /**
         * Validate and normalize a path
         *
         * @param path the path to validate
         * @return normalized safe path
         * @throws SmbException if path is invalid or dangerous
         */
        public String validatePath(String path) throws SmbException {
            if (path == null || path.isEmpty()) {
                throw new SmbException("Path cannot be null or empty");
            }
    
            // Check length
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Sat Aug 30 05:58:03 UTC 2025
    - 14.5K bytes
    - Viewed (0)
  4. src/main/java/jcifs/util/ServerResponseValidator.java

            }
        }
    
        /**
         * Validate path from server response
         *
         * @param path path to validate
         * @throws SmbException if path is invalid
         */
        public void validatePath(String path) throws SmbException {
            totalValidations.incrementAndGet();
    
            if (path == null || path.isEmpty()) {
                return; // Empty paths allowed
            }
    
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Sat Aug 30 05:58:03 UTC 2025
    - 16.6K bytes
    - Viewed (0)
Back to top