View | Details | Raw Unified | Return to bug 9554
Collapse All | Expand All

(-)pmount-0.9.9.orig/man/pmount.1 (+9 lines)
Lines 159-164 support setting the character set (see Link Here
159
(8) for details).
159
(8) for details).
160
160
161
.TP
161
.TP
162
.B \-P \fIcodepage\fR, \fB\-\-codepage \fIcodepage
163
Use given I/O character set. This
164
corresponds with the mount option
165
.B codepage\fR. This option is ignored for file systems that do not
166
support setting the codepage set (see
167
.B mount
168
(8) for details).
169
170
.TP
162
.B \-u \fIumask\fR, \fB\-\-umask \fIumask\fR
171
.B \-u \fIumask\fR, \fB\-\-umask \fIumask\fR
163
Use specified umask instead of the default one. For UDF, the default
172
Use specified umask instead of the default one. For UDF, the default
164
is '007', for VFAT and NTFS the default is '077'. This value is
173
is '007', for VFAT and NTFS the default is '077'. This value is
(-)pmount-0.9.9.orig/src/fs.c (-13 / +13 lines)
Lines 19-37 Link Here
19
 * to command line options.
19
 * to command line options.
20
 */
20
 */
21
static struct FS supported_fs[] = {
21
static struct FS supported_fs[] = {
22
    { "udf", "nosuid,nodev,user", 1, "007", 1 },
22
    { "udf", "nosuid,nodev,user", 1, "007", 1, 0 },
23
    { "iso9660", "nosuid,nodev,user", 1, NULL, 1 },
23
    { "iso9660", "nosuid,nodev,user", 1, NULL, 1, 0 },
24
    { "vfat", "nosuid,nodev,user,quiet,shortname=mixed", 1, "077", 1 },
24
    { "vfat", "nosuid,nodev,user,quiet,shortname=mixed", 1, "077", 1, 1 },
25
    { "ntfs", "nosuid,nodev,user", 1, "077", 1 },
25
    { "ntfs", "nosuid,nodev,user", 1, "077", 1, 0 },
26
    { "hfsplus", "nosuid,nodev,user", 1, NULL, 0 },
26
    { "hfsplus", "nosuid,nodev,user", 1, NULL, 0, 0 },
27
    { "hfs", "nosuid,nodev,user", 1, NULL, 0 },
27
    { "hfs", "nosuid,nodev,user", 1, NULL, 0, 0 },
28
    { "ext3", "nodev,noauto,nosuid,user", 0, NULL, 0 },
28
    { "ext3", "nodev,noauto,nosuid,user", 0, NULL, 0, 0 },
29
    { "ext2", "nodev,noauto,nosuid,user", 0, NULL, 0 },
29
    { "ext2", "nodev,noauto,nosuid,user", 0, NULL, 0, 0 },
30
    { "reiserfs", "nodev,noauto,nosuid,user", 0, NULL, 0 },
30
    { "reiserfs", "nodev,noauto,nosuid,user", 0, NULL, 0, 0 },
31
    { "reiser4", "nodev,noauto,nosuid,user", 0, NULL, 0 },
31
    { "reiser4", "nodev,noauto,nosuid,user", 0, NULL, 0, 0 },
32
    { "xfs", "nodev,noauto,nosuid,user", 0, NULL, 0 },
32
    { "xfs", "nodev,noauto,nosuid,user", 0, NULL, 0, 0 },
33
    { "jfs", "nodev,noauto,nosuid,user", 0, NULL, 1 },
33
    { "jfs", "nodev,noauto,nosuid,user", 0, NULL, 1, 0 },
34
    { NULL, NULL, 0, NULL, 0}
34
    { NULL, NULL, 0, NULL, 0, 0}
35
};
35
};
36
36
37
const struct FS*
37
const struct FS*
(-)pmount-0.9.9.orig/src/fs.h (+1 lines)
Lines 20-25 struct FS { Link Here
20
    int support_ugid;      /* whether the fs supports uid and gid options */
20
    int support_ugid;      /* whether the fs supports uid and gid options */
21
    const char* umask;     /* umask value (NULL if umask is not supported) */
21
    const char* umask;     /* umask value (NULL if umask is not supported) */
22
    int support_iocharset; /* whether the fs supports the iocharset option */
22
    int support_iocharset; /* whether the fs supports the iocharset option */
23
    int support_codepage;  /* whether the fs supports the codepage option */
23
};
24
};
24
25
25
/**
26
/**
(-)pmount-0.9.9.orig/src/pmount.c (-24 / +42 lines)
Lines 65-86 usage( const char* exename ) Link Here
65
    "  Remove the lock on <device> for process <pid> again.\n\n"),
65
    "  Remove the lock on <device> for process <pid> again.\n\n"),
66
        exename);
66
        exename);
67
    puts( _("Options:\n"
67
    puts( _("Options:\n"
68
    "  -r          : force <device> to be mounted read-only\n"
68
    "  -r           : force <device> to be mounted read-only\n"
69
    "  -w          : force <device> to be mounted read-write\n"
69
    "  -w           : force <device> to be mounted read-write\n"
70
    "  -s, --sync  : mount <device> with the 'sync' option (default: 'async')\n"
70
    "  -s, --sync   : mount <device> with the 'sync' option (default: 'async')\n"
71
    "  --noatime   : mount <device> with the 'noatime' option (default: 'atime')\n"
71
    "  --noatime    : mount <device> with the 'noatime' option (default: 'atime')\n"
72
    "  -e, --exec  : mount <device> with the 'exec' option (default: 'noexec')\n"
72
    "  -e, --exec   : mount <device> with the 'exec' option (default: 'noexec')\n"
73
    "  -t <fs>     : mount as file system type <fs> (default: autodetected)\n"
73
    "  -t <fs>      : mount as file system type <fs> (default: autodetected)\n"
74
    "  -c <charset>: use given I/O character set (default: 'utf8' if called\n"
74
    "  -c <charset> : use given I/O character set (default: 'utf8' if called\n"
75
    "                in an UTF-8 locale, otherwise mount default)\n"
75
    "                 in an UTF-8 locale, otherwise mount default)\n"
76
    "  -u <umask>  : use specified umask instead of the default (only for\n"
76
    "  -P <codepage>: use given codepage set\n"
77
    "                file sytems which actually support umask setting)\n"
77
    "  -u <umask>   : use specified umask instead of the default (only for\n"
78
    "                 file sytems which actually support umask setting)\n"
78
    " --passphrase <file>\n"
79
    " --passphrase <file>\n"
79
    "                read passphrase from file instead of the terminal\n"
80
    "                 read passphrase from file instead of the terminal\n"
80
    "                (only for LUKS encrypted devices)\n"
81
    "                 (only for LUKS encrypted devices)\n"
81
    "  -d, --debug : enable debug output (very verbose)\n"
82
    "  -d, --debug  : enable debug output (very verbose)\n"
82
    "  -h, --help  : print help message and exit successfuly\n"
83
    "  -h, --help   : print help message and exit successfuly\n"
83
    "  --version   : print version number and exit successfully") );
84
    "  --version    : print version number and exit successfully") );
84
}
85
}
85
86
86
/**
87
/**
Lines 200-205 do_mount_fstab( const char* device ) Link Here
200
 * @param force_write 1 for forced r/w, 0 for forced r/o, -1 for kernel default
201
 * @param force_write 1 for forced r/w, 0 for forced r/o, -1 for kernel default
201
 * @param iocharset charset to use for file name conversion; NULL for mount
202
 * @param iocharset charset to use for file name conversion; NULL for mount
202
 *        default
203
 *        default
204
 * @param codepage codepage to use for file name conversion; NULL for mount
205
 *        default
203
 * @param umask User specified umask (NULL for default)
206
 * @param umask User specified umask (NULL for default)
204
 * @param suppress_errors: if true, stderr is redirected to /dev/null
207
 * @param suppress_errors: if true, stderr is redirected to /dev/null
205
 * @return exit status of mount, or -1 on failure.
208
 * @return exit status of mount, or -1 on failure.
Lines 207-218 do_mount_fstab( const char* device ) Link Here
207
int
210
int
208
do_mount( const char* device, const char* mntpt, const char* fsname, int async,
211
do_mount( const char* device, const char* mntpt, const char* fsname, int async,
209
        int noatime, int exec, int force_write, const char* iocharset, const
212
        int noatime, int exec, int force_write, const char* iocharset, const
210
        char* umask, int suppress_errors )
213
	char* codepage, const char* umask, int suppress_errors )
211
{
214
{
212
    const struct FS* fs;
215
    const struct FS* fs;
213
    char ugid_opt[100];
216
    char ugid_opt[100];
214
    char umask_opt[100];
217
    char umask_opt[100];
215
    char iocharset_opt[100];
218
    char iocharset_opt[100];
219
    char codepage_opt[100];
216
    const char* sync_opt = ",sync";
220
    const char* sync_opt = ",sync";
217
    const char* atime_opt = ",atime";
221
    const char* atime_opt = ",atime";
218
    const char* exec_opt = ",noexec";
222
    const char* exec_opt = ",noexec";
Lines 238-244 do_mount( const char* device, const char Link Here
238
    }
242
    }
239
243
240
    /* assemble option string */
244
    /* assemble option string */
241
    *ugid_opt = *umask_opt = *iocharset_opt = 0;
245
    *ugid_opt = *umask_opt = *iocharset_opt = *codepage_opt = 0;
242
    if( fs->support_ugid )
246
    if( fs->support_ugid )
243
        snprintf( ugid_opt, sizeof( ugid_opt ), ",uid=%i,gid=%i", 
247
        snprintf( ugid_opt, sizeof( ugid_opt ), ",uid=%i,gid=%i", 
244
                getuid(), getgid() );
248
                getuid(), getgid() );
Lines 271-279 do_mount( const char* device, const char Link Here
271
        snprintf( iocharset_opt, sizeof( iocharset_opt ), ",iocharset=%s", iocharset );
275
        snprintf( iocharset_opt, sizeof( iocharset_opt ), ",iocharset=%s", iocharset );
272
    }
276
    }
273
277
274
    snprintf( options, sizeof( options ), "%s%s%s%s%s%s%s%s", 
278
    if( codepage && fs->support_codepage ) {
279
        if( !is_word_str( codepage ) ) {
280
            fprintf( stderr, _("Error: invalid codepage name '%s'\n"), codepage );
281
            return -1;
282
        }
283
        snprintf( codepage_opt, sizeof( codepage_opt ), ",codepage=%s", codepage );
284
    }
285
286
    snprintf( options, sizeof( options ), "%s%s%s%s%s%s%s%s%s", 
275
            fs->options, sync_opt, atime_opt, exec_opt, access_opt, ugid_opt,
287
            fs->options, sync_opt, atime_opt, exec_opt, access_opt, ugid_opt,
276
            umask_opt, iocharset_opt );
288
            umask_opt, iocharset_opt, codepage_opt );
277
289
278
    /* go for it */
290
    /* go for it */
279
    return spawnl( SPAWN_EROOT | SPAWN_RROOT | (suppress_errors ? SPAWN_NO_STDERR : 0 ),
291
    return spawnl( SPAWN_EROOT | SPAWN_RROOT | (suppress_errors ? SPAWN_NO_STDERR : 0 ),
Lines 293-305 do_mount( const char* device, const char Link Here
293
 * @param force_write 1 for forced r/w, 0 for forced r/o, -1 for kernel default
305
 * @param force_write 1 for forced r/w, 0 for forced r/o, -1 for kernel default
294
 * @param iocharset charset to use for file name conversion; NULL for mount
306
 * @param iocharset charset to use for file name conversion; NULL for mount
295
 *        default
307
 *        default
308
 * @param codepage codepage to use for file name conversion; NULL for mount
309
 *        default
296
 * @param umask User specified umask (NULL for default)
310
 * @param umask User specified umask (NULL for default)
297
 * @return last return value of do_mount (i. e. 0 on success, != 0 on error)
311
 * @return last return value of do_mount (i. e. 0 on success, != 0 on error)
298
 */
312
 */
299
int
313
int
300
do_mount_auto( const char* device, const char* mntpt, int async, 
314
do_mount_auto( const char* device, const char* mntpt, int async, 
301
        int noatime, int exec, int force_write, const char* iocharset, 
315
        int noatime, int exec, int force_write, const char* iocharset, 
302
        const char* umask )
316
        const char* codepage, const char* umask )
303
{
317
{
304
    const struct FS* fs;
318
    const struct FS* fs;
305
    int nostderr = 1;
319
    int nostderr = 1;
Lines 310-323 do_mount_auto( const char* device, const Link Here
310
        if( (fs+1)->fsname == NULL )
324
        if( (fs+1)->fsname == NULL )
311
            nostderr = 0;
325
            nostderr = 0;
312
        result = do_mount( device, mntpt, fs->fsname, async, noatime, exec,
326
        result = do_mount( device, mntpt, fs->fsname, async, noatime, exec,
313
                force_write, iocharset, umask, nostderr );
327
                force_write, iocharset, codepage, umask, nostderr );
314
        if( result == 0 )
328
        if( result == 0 )
315
            break;
329
            break;
316
330
317
	/* sometimes VFAT fails when using iocharset; try again without */
331
	/* sometimes VFAT fails when using iocharset; try again without */
318
	if( iocharset )
332
	if( iocharset )
319
	    result = do_mount( device, mntpt, fs->fsname, async, noatime, exec,
333
	    result = do_mount( device, mntpt, fs->fsname, async, noatime, exec,
320
                    force_write, NULL, umask, nostderr );
334
                    force_write, NULL, NULL, umask, nostderr );
321
        if( result <= 0 )
335
        if( result <= 0 )
322
            break;
336
            break;
323
    }
337
    }
Lines 485-490 main( int argc, char** argv ) Link Here
485
    int force_write = -1; /* 0: ro, 1: rw, -1: default */
499
    int force_write = -1; /* 0: ro, 1: rw, -1: default */
486
    const char* use_fstype = NULL;
500
    const char* use_fstype = NULL;
487
    const char* iocharset = NULL;
501
    const char* iocharset = NULL;
502
    const char* codepage = NULL;
488
    const char* umask = NULL;
503
    const char* umask = NULL;
489
    const char* passphrase = NULL;
504
    const char* passphrase = NULL;
490
    int result;
505
    int result;
Lines 502-507 main( int argc, char** argv ) Link Here
502
        { "exec", 0, NULL, 'e' },
517
        { "exec", 0, NULL, 'e' },
503
        { "type", 1, NULL, 't' },
518
        { "type", 1, NULL, 't' },
504
        { "charset", 1, NULL, 'c' },
519
        { "charset", 1, NULL, 'c' },
520
        { "codepage", 1, NULL, 'P' },
505
        { "umask", 1, NULL, 'u' },
521
        { "umask", 1, NULL, 'u' },
506
        { "passphrase", 1, NULL, 'p' },
522
        { "passphrase", 1, NULL, 'p' },
507
        { "read-only", 0, NULL, 'r' },
523
        { "read-only", 0, NULL, 'r' },
Lines 549-554 main( int argc, char** argv ) Link Here
549
565
550
            case 'c': iocharset = optarg; break;
566
            case 'c': iocharset = optarg; break;
551
567
568
            case 'P': codepage = optarg; break;
569
552
            case 'u': umask = optarg; break;
570
            case 'u': umask = optarg; break;
553
571
554
            case 'p': passphrase = optarg; break;
572
            case 'p': passphrase = optarg; break;
Lines 684-693 main( int argc, char** argv ) Link Here
684
            /* off we go */
702
            /* off we go */
685
            if( use_fstype )
703
            if( use_fstype )
686
                result = do_mount( decrypted_device, mntpt, use_fstype, async, noatime,
704
                result = do_mount( decrypted_device, mntpt, use_fstype, async, noatime,
687
                        exec, force_write, iocharset, umask, 0 );
705
                        exec, force_write, iocharset, codepage, umask, 0 );
688
            else
706
            else
689
                result = do_mount_auto( decrypted_device, mntpt, async, noatime, exec,
707
                result = do_mount_auto( decrypted_device, mntpt, async, noatime, exec,
690
                        force_write, iocharset, umask ); 
708
                        force_write, iocharset, codepage, umask ); 
691
709
692
            /* unlock the mount point again */
710
            /* unlock the mount point again */
693
            debug( "unlocking mount point directory\n" );
711
            debug( "unlocking mount point directory\n" );

Return to bug 9554