@ -845,10 +845,10 @@ struct CdrtracK {
/** Eventually detected data image size */
double data_image_size ;
char * iso_fs_descr ; /* eventually block 16 to 31 of input during detection */
/** W ether to demand a detected data image size and use it (or else abort) */
/** W h ether to demand a detected data image size and use it (or else abort) */
int use_data_image_size ; /* 0=no, 1=size not defined yet, 2=size defined */
/* w ether the data source is a container of defined size with possible tail */
/* Wh ether the data source is a container of defined size with possible tail*/
int extracting_container ;
/** Optional fifo between input fd and libburn. It uses a pipe(2) to transfer
@ -1056,7 +1056,7 @@ int Cdrtrack_get_fifo(struct CdrtracK *track, struct CdrfifO **fifo, int flag)
}
/** Try w ether automatic audio extraction is appropriate and eventually open
/** Try w h ether automatic audio extraction is appropriate and eventually open
a file descriptor to the raw data .
@ return - 3 identified as . wav but with cdrecord - inappropriate parameters
- 2 could not open track source , no use in retrying
@ -1661,7 +1661,7 @@ struct CdrpreskiN {
char queue_severity [ 81 ] ;
char print_severity [ 81 ] ;
/** W ether to wait for available standard input data before touching drives */
/** W h ether to wait for available standard input data before touching drives*/
int do_waiti ;
/** Stores eventually given absolute device address before translation */
@ -1686,41 +1686,44 @@ struct CdrpreskiN {
*/
int abort_handler ;
/** W ether to allow getuid()!=geteuid() */
/** W h ether to allow getuid()!=geteuid() */
int allow_setuid ;
/** W ether to allow user provided addresses like #4 */
/** W h ether to allow user provided addresses like #4 */
int allow_fd_source ;
/** W ether to support media types which are implemented but yet untested */
/** W h ether to support media types which are implemented but yet untested */
int allow_untested_media ;
/** Wether to allow libburn pseudo-drives "stdio:<path>" */
/** Whether to allow libburn pseudo-drives "stdio:<path>" .
0 = forbidden , 1 = seems ok ,
2 = potentially forbidden ( depends on uid , euid , file type )
*/
int allow_emulated_drives ;
/** Wether an option is given which needs a full bus scan */
/** W h ether an option is given which needs a full bus scan */
int no_whitelist ;
/** W ether the translated device address shall not follow softlinks, device
/** W h ether the translated device address shall not follow softlinks, device
clones and SCSI addresses */
int no_convert_fs_adr ;
/** W ether Bus,Target,Lun addresses shall be converted literally as old
/** W h ether Bus,Target,Lun addresses shall be converted literally as old
Pseudo SCSI - Adresses . New default is to use ( possibly system emulated )
real SCSI addresses via burn_drive_convert_scsi_adr ( ) and literally
emulated and cdrecord - incompatible ATA : addresses . */
int old_pseudo_scsi_adr ;
/** W ether bus scans shall exit!=0 if no drive was found */
/** W h ether bus scans shall exit!=0 if no drive was found */
int scan_demands_drive ;
/** W ether to abort when a busy drive is encountered during bus scan */
/** W h ether to abort when a busy drive is encountered during bus scan */
int abort_on_busy_drive ;
/** Linux specific : W ether to try to avoid collisions when opening drives */
/** Linux specific : W h ether to try to avoid collisions when opening drives */
int drive_exclusive ;
/** Linux specific : W ether to obtain an exclusive drive lock via fcntl() */
/** Linux specific : W h ether to obtain an exclusive drive lock via fcntl() */
int drive_fcntl_f_setlk ;
/** Linux specific : Device file address family to use :
@ -1728,7 +1731,7 @@ struct CdrpreskiN {
int drive_scsi_dev_family ;
/** W ether to try to wait for unwilling drives to become willing to open */
/** W h ether to try to wait for unwilling drives to become willing to open */
int drive_blocking ;
/** Explicit write mode option is determined before skin processes
@ -1946,6 +1949,52 @@ int Cdrpreskin_queue_msgs(struct CdrpreskiN *o, int flag)
}
/** Evaluate whether the user would be allowed in any case to use device_adr
as pseudo - drive */
int Cdrpreskin__allows_emulated_drives ( char * device_adr , char reason [ 4096 ] ,
int flag )
{
struct stat stbuf ;
reason [ 0 ] = 0 ;
if ( device_adr [ 0 ] ) {
if ( strcmp ( device_adr , " /dev/null " ) = = 0 )
return ( 1 ) ;
strcat ( reason , " File object is not /dev/null. " ) ;
}
if ( getuid ( ) ! = geteuid ( ) ) {
strcat ( reason , " UID and EUID differ " ) ;
return ( 0 ) ;
}
if ( getuid ( ) ! = 0 )
return ( 1 ) ;
strcat ( reason , " UID is 0. " ) ;
/* Directory must be owned by root and write protected against any others*/
if ( lstat ( " /root/cdrskin_permissions " , & stbuf ) = = - 1 | | ! S_ISDIR ( stbuf . st_mode ) ) {
strcat ( reason , " No directory /root/cdrskin_permissions exists " ) ;
return ( 0 ) ;
}
if ( stbuf . st_uid ! = 0 ) {
strcat ( reason , " Directory /root/cdrskin_permissions not owned by UID 0 " ) ;
return ( 0 ) ;
}
if ( stbuf . st_mode & ( S_IWGRP | S_IWOTH ) ) {
strcat ( reason ,
" Directory /root/cdrskin_permissions has w-permission for group or others " ) ;
return ( 0 ) ;
}
if ( stat ( " /root/cdrskin_permissions/allow_emulated_drives " , & stbuf ) = = - 1 ) {
strcat ( reason ,
" No file /root/cdrskin_permissions/allow_emulated_drives exists " ) ;
return ( 0 ) ;
}
reason [ 0 ] = 0 ;
return ( 1 ) ;
}
int Cdrpreskin_consider_normal_user ( int flag )
{
fprintf ( stderr ,
@ -2177,7 +2226,7 @@ return:
*/
{
int i , ret ;
char * value_pt ;
char * value_pt , reason [ 4096 ] ;
# ifndef Cdrskin_extra_leaN
if ( argc > 1 ) {
@ -2220,10 +2269,12 @@ return:
o - > abort_handler = 3 ;
} else if ( strcmp ( argv [ i ] , " --allow_emulated_drives " ) = = 0 ) {
if ( getuid ( ) ! = geteuid ( ) ) {
if ( Cdrpreskin__allows_emulated_drives ( " " , reason , 0 ) < = 0 ) {
fprintf ( stderr , " cdrskin: WARNING : %s. \n " , reason ) ;
fprintf ( stderr ,
" cdrskin: SORRY : uid and euid differ. Will not --allow_emulated_drives \n " ) ;
" cdrskin: WARNING : Only /dev/null will be available with \" stdio: \" . \n " ) ;
Cdrpreskin_consider_normal_user ( 0 ) ;
o - > allow_emulated_drives = 2 ;
} else
o - > allow_emulated_drives = 1 ;
@ -2360,15 +2411,18 @@ set_dev:;
}
if ( o - > allow_emulated_drives ) {
fprintf ( stderr , " \n Transport name: \t \t libburn on standard i/o \n " ) ;
fprintf ( stderr ,
" Transport descr.: \t write into data files and block devices \n " ) ;
if ( o - > allow_emulated_drives = = 2 )
fprintf ( stderr , " Transport descr.: \t root or setuid may only write into /dev/null \n " ) ;
else
fprintf ( stderr , " Transport descr.: \t write into file objects \n " ) ;
fprintf ( stderr , " Transp. layer ind.: \t stdio: \n " ) ;
fprintf ( stderr , " Target specifier: \t path \n " ) ;
fprintf ( stderr , " Target example: \t \t stdio:/tmp/pseudo_drive \n " ) ;
fprintf ( stderr , " SCSI Bus scanning: \t not supported \n " ) ;
fprintf ( stderr , " Open via UNIX device: \t supported \n " ) ;
} else {
printf ( " \n cdrskin: NOTE : Option --allow_emulated_drives would allow dev=stdio:<path> \n " ) ;
if ( Cdrpreskin__allows_emulated_drives ( " " , reason , 0 ) > 0 )
printf ( " \n cdrskin: NOTE : Option --allow_emulated_drives would allow dev=stdio:<path> \n " ) ;
}
# else /* ! Cdrskin_extra_leaN */
@ -2450,8 +2504,7 @@ set_dev:;
printf (
" --adjust_speed_to_drive set only speeds offered by drive and media \n " ) ;
# endif
printf (
" --allow_emulated_drives dev=stdio:<path> on files and block devices \n " ) ;
printf ( " --allow_emulated_drives dev=stdio:<path> on file objects \n " ) ;
printf (
" --allow_setuid disable setuid warning (setuid is insecure !) \n " ) ;
printf (
@ -3031,7 +3084,7 @@ struct CdrskiN {
char device_adr [ Cdrskin_adrleN ] ;
/** Progress state info: w ether libburn is actually processing payload data */
/** Progress state info: w h ether libburn is actually processing payload data*/
int is_writing ;
/** Previously detected drive state */
enum burn_drive_status previous_drive_status ;
@ -3043,7 +3096,7 @@ struct CdrskiN {
int lib_is_initialized ;
pid_t control_pid ; /* pid of the thread that calls libburn */
int drive_is_grabbed ;
int drive_is_busy ; /* W ether drive was told to do something cancel-worthy */
int drive_is_busy ; /* W h ether drive was told to do something cancel-worthy */
struct burn_drive * grabbed_drive ;
# ifndef Cdrskin_extra_leaN
@ -3981,7 +4034,7 @@ adr_translation:;
/* user defined address translation */
if ( ! ( flag & 1 ) ) {
if ( ret > 0 ) {
/* try w ether a translation points to loc */
/* try w h ether a translation points to loc */
hret = Cdradrtrn_translate ( skin - > adr_trn , loc , driveno , buf , 1 ) ;
if ( hret = = 2 ) {
still_untranslated = 0 ;
@ -5292,7 +5345,7 @@ ex:;
# ifdef Cdrskin_libburn_write_mode_ruleS
/** After everything else about burn_write_opts and burn_disc is set up, this
call determines the effective write mode and checks w ether the drive
call determines the effective write mode and checks w h ether the drive
promises to support it .
*/
int Cdrskin_activate_write_mode ( struct CdrskiN * skin ,
@ -5367,7 +5420,7 @@ report_failure:;
# else /* Cdrskin_libburn_write_mode_ruleS */
/** Determines the effective write mode and checks w ether the drive promises
/** Determines the effective write mode and checks w h ether the drive promises
to support it .
@ param s state of target media , obtained from burn_disc_get_status ( ) ,
submit BURN_DISC_BLANK if no real state is available
@ -5473,7 +5526,7 @@ int Cdrskin_activate_write_mode(struct CdrskiN *skin, enum burn_disc_status s,
skin - > block_type = BURN_BLOCK_SAO ;
}
/* check w ether desired type combination is available with drive */
/* check w h ether desired type combination is available with drive */
if ( skin - > driveno < 0 | | skin - > driveno > skin - > n_drives ) {
if ( skin - > verbosity > = Cdrskin_verbose_debuG )
ClN ( printf ( " cdrskin_debug: WARNING : No drive selected with Cdrskin_activate_write_mode \n " ) ) ;
@ -7518,7 +7571,7 @@ ignore_unknown:;
/** Initialize libburn, create a CdrskiN program run control object,
set eventual device whitelist , and obtain the list of available drives .
@ param o Returns the CdrskiN object created
@ param lib_initialized Returns w ether libburn was initialized here
@ param lib_initialized Returns w h ether libburn was initialized here
@ param exit_value Returns after error the proposal for an exit value
@ param flag Unused yet
@ return < = 0 error , 1 success
@ -7528,6 +7581,7 @@ int Cdrskin_create(struct CdrskiN **o, struct CdrpreskiN **preskin,
{
int ret , stdio_drive = 0 ;
struct CdrskiN * skin ;
char reason [ 4096 ] ;
* o = NULL ;
* exit_value = 0 ;
@ -7538,15 +7592,23 @@ int Cdrskin_create(struct CdrskiN **o, struct CdrpreskiN **preskin,
( * preskin ) - > device_adr ) ) ;
burn_drive_add_whitelist ( ( * preskin ) - > device_adr ) ;
if ( strncmp ( ( * preskin ) - > device_adr , " stdio: " , 6 ) = = 0 ) {
if ( ( * preskin ) - > allow_emulated_drives ) {
ret = Cdrpreskin__allows_emulated_drives ( ( * preskin ) - > device_adr + 6 , reason , 0 ) ;
if ( ( * preskin ) - > allow_emulated_drives & & ret > 0 ) {
stdio_drive = 1 ;
( * preskin ) - > demands_cdrskin_caps = 1 ;
} else if ( ( * preskin ) - > allow_emulated_drives ) {
fprintf ( stderr , " cdrskin: SORRY : dev=stdio:... rejected despite --allow_emulated_drives \n " ) ;
fprintf ( stderr , " cdrskin: SORRY : Reason: %s. \n " , reason ) ;
} else {
fprintf ( stderr , " cdrskin: SORRY : dev=stdio:... works only with option --allow_emulated_drives \n " ) ;
if ( getuid ( ) ! = geteuid ( ) ) {
fprintf ( stderr , " cdrskin: SORRY : but uid and euid differ. So this option will be rejected. \n " ) ;
Cdrpreskin_consider_normal_user ( 0 ) ;
if ( ret < = 0 ) {
fprintf ( stderr , " cdrskin: SORRY : but: %s. \n " , reason ) ;
fprintf ( stderr ,
" cdrskin: SORRY : So this option would not help anyway. \n " ) ;
}
}
if ( ! stdio_drive ) {
Cdrpreskin_consider_normal_user ( 0 ) ;
{ * exit_value = 2 ; goto ex ; }
}
}