This file is indexed.

/usr/share/doc/libjcifs-java/examples/TestSmbURL.java is in libjcifs-java-doc 1.3.19-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
import java.util.Date;
import jcifs.smb.*;
import java.io.*;

public class TestSmbURL {

    static void test( String url, String name ) throws Exception {
        SmbFile f;

        if( name == null ) name = "";

        System.out.println( "INPUT[" + url + ", " + name + "]");
        try {
            f = new SmbFile( url, name );
        } catch( Exception e ) {
            e.printStackTrace();
            return;
        }

        System.out.print( "toString()         : " );
        try {
            System.out.println( f.toString() );
        } catch( Exception e ) {
            e.printStackTrace(); System.out.println();
        }
        System.out.print( "getCanonicalPath() : " );
        try {
            System.out.println( f.getCanonicalPath() );
        } catch( Exception e ) {
            e.printStackTrace(); System.out.println();
        }
        System.out.print( "getUncPath()       : " );
        try {
            System.out.println( f.getUncPath() );
        } catch( Exception e ) {
            e.printStackTrace(); System.out.println();
        }
        System.out.print( "getName()          : " );
        try {
            System.out.println( f.getName() );
        } catch( Exception e ) {
            e.printStackTrace(); System.out.println();
        }
        System.out.print( "getParent()        : " );
        try {
            System.out.println( f.getParent() );
        } catch( Exception e ) {
            e.printStackTrace(); System.out.println();
        }
        System.out.print( "getPath()          : " );
        try {
            System.out.println( f.getPath() );
        } catch( Exception e ) {
            e.printStackTrace(); System.out.println();
        }
        System.out.print( "getServer()        : " );
        try {
            System.out.println( f.getServer() );
        } catch( Exception e ) {
            e.printStackTrace(); System.out.println();
        }
        System.out.print( "getShare()         : " );
        try {
            System.out.println( f.getShare() );
        } catch( Exception e ) {
            e.printStackTrace(); System.out.println();
        }
        System.out.print( "exists()           : " );
        try {
            System.out.println( f.exists() );
        } catch( Exception e ) {
            e.printStackTrace(); System.out.println();
        }
        System.out.print( "isDirectory()      : " );
        try {
            System.out.println( f.isDirectory() );
        } catch( Exception e ) {
            e.printStackTrace(); System.out.println();
        }
        System.out.print( "isFile()           : " );
        try {
            System.out.println( f.isFile() );
        } catch( Exception e ) {
            e.printStackTrace(); System.out.println();
        }
        System.out.print( "length()           : " );
        try {
            System.out.println( f.length() );
        } catch( Exception e ) {
            e.printStackTrace(); System.out.println();
        }
        System.out.print( "lastModified()     : " );
        try {
            System.out.println( (new Date( f.lastModified() )));
        } catch( Exception e ) {
            e.printStackTrace(); System.out.println();
        }
        System.out.print( "toURL().toString() : " );
        try {
            System.out.println( f.toURL() );
        } catch( Exception e ) {
            e.printStackTrace(); System.out.println();
        }

        System.in.read();
    }

    public static void main( String argv[] ) throws Exception {
        String workgroup, server, share, path, file;

        if( argv.length < 5 ) {
            System.err.println( "TestSmbURL workgroup server share path file" );
            System.exit( 1 );
        }

        workgroup = argv[0];
        server = argv[1];
        share = argv[2];
        path = argv[3];
        file = argv[4];

/*
        System.out.println();
        System.out.println( "-- UNUSUAL --" );
        System.out.println();
        test( "smb://" + server, "../" + server + "/" + share );
        test( "smb://foo", "../" + workgroup );
        test( "smb://", ".." );
*/

        System.out.println();
        System.out.println( "-- BASICS: ONE ARGUMENT --" );
        System.out.println();
        test( "smb://" + server + "/" + share + "/" + path + "/" + file, null );
        test( "smb://" + server + "/" + share + "/" + path + "/", null );
        test( "smb://" + server + "/" + share + "/", null );
        test( "smb://" + server + "/", null );
        test( "smb://" + workgroup + "/", null );
        test( "smb://", null );

        System.out.println();
        System.out.println( "-- BASICS: TWO ARGUMENTS --" );
        System.out.println();
        test( "smb://" + server + "/" + share + "/" + path + "/", file);
        test( "smb://" + server + "/" + share + "/", path + "/" + file);
        test( "smb://" + server + "/", share + "/" + path + "/" + file);
        test( "smb://", server + "/" + share + "/" + path + "/" + file);
        test( "smb://", "smb://" + server + "/" + share + "/" + path + "/" + file);
        test( "smb://", "smb://" + server + "/");
        test( "smb://", "smb://" + workgroup + "/");
        test( "smb://", "smb://");
        test( "smb://" + server + "/share/", "smb://");

        System.out.println();
        System.out.println( "-- CANONICALIZATION --" );
        System.out.println();
        test( "smb://" + server + "/" + share + "/foo/../" + path + "/" + file, null );
        test( "smb://" + server + "/foo/bar/.././../" + share + "/" + path + "/" + file, null );
        test( "smb://" + server + "/foo/bar/.././.././" + share + "/fake/../" + path + "/" + file, null );
        test( "smb://" + server + "/foo/bar/.././.././", share + "/fake/../" + path + "/" + file);
        test( "smb://", server + "/foo/bar/.././.././" + share + "/fake/../" + path + "/" + file);
    }
}