Mercurial > mplayer.hg
annotate libmpdemux/dvdauth.c @ 9500:4930b82dbf02
forgot ...
author | michael |
---|---|
date | Mon, 24 Feb 2003 22:46:48 +0000 |
parents | 059746b0ecae |
children | a5785a0b9ee1 |
rev | line source |
---|---|
3975
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
1 /* (C)2001,2002 by LGB (Gabor Lenart), based on example programs in libcss |
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
2 lgb@lgb.hu |
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
3 |
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
4 This source is part of MPlayer project. This source is copyrighted by |
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
5 the author according to rules declared in GNU/GPL license. |
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
6 |
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
7 2001 Inital version (LGB) |
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
8 2001 fibmap_mplayer to avoid uid=0 mplayer need (LGB) |
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
9 2001 Support for libcss with the new API (by ???) |
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
10 2002/Jan/04 Use dlopen to access libcss.so to avoid conflict with |
7459
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
11 libdvdread [now with only libcss with old API (LGB) |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
12 2002/Sep/21 Fix a bug which caused segmentation fault when using |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
13 -dvdkey option, since css.so was only loaded by -dvdauth. |
7476 | 14 (LGB, reported and suggested by sbmpost <wortelsapje@hotmail.com>) |
7459
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
15 Also some cosmetic fix with return value of dvd_css_descramble(). |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
16 2002/Sep/21 Try to load css syms with AND without underscore at their |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
17 names, probably not only OpenBSD requires this so it's a |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
18 better solution (LGB). |
3975
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
19 |
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
20 TODO: |
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
21 support for libcss libraries with new API */ |
492 | 22 |
23 /* don't do anything with this source if css support was not requested */ | |
24 #include "config.h" | |
25 #ifdef HAVE_LIBCSS | |
26 | |
3975
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
27 #warning FIXME: Dynamic loading of libcss.so with newer (ver>0.1) libcss API is not supported in this version! |
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
28 |
492 | 29 #include <stdio.h> |
30 #include <stdlib.h> | |
1042
b333271f4e7c
Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents:
1018
diff
changeset
|
31 //#include <string.h> // FIXME: conflicts with fs.h |
1510
9ffe6c1a33b9
In case the open on the dvd device fails, print some hints based on errno
jkeil
parents:
1177
diff
changeset
|
32 #include <errno.h> |
492 | 33 #include <unistd.h> |
34 #include <fcntl.h> | |
35 #include <sys/types.h> | |
36 #include <sys/ioctl.h> | |
37 #include <sys/stat.h> | |
1163
ac1341d4a2a7
According an idea, mplayer now can use external setuid root wrapper to do FIBMAP ioctl (requires root priv). Also, a serious bug was fixed in dvdauth.c made by some guy when mixing old and new style CSS API into dvdauth.c ;-)
lgb
parents:
1042
diff
changeset
|
38 #include <sys/wait.h> |
3975
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
39 // #include <css.h> |
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
40 |
5872 | 41 #if defined(__FreeBSD__) || defined(__NetBSD__) |
1042
b333271f4e7c
Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents:
1018
diff
changeset
|
42 # include <sys/dvdio.h> |
5872 | 43 #elif defined(__OpenBSD__) |
44 # include <sys/cdio.h> | |
45 # define RTLD_NOW RTLD_LAZY | |
3975
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
46 #elif defined(__linux__) |
1042
b333271f4e7c
Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents:
1018
diff
changeset
|
47 # include <linux/cdrom.h> |
3975
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
48 #elif defined(__sun) |
1042
b333271f4e7c
Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents:
1018
diff
changeset
|
49 # include <sun/dvdio.h> |
7423
ad967766679a
hpux DVD support fixes by Martin Gansser <mgansser@ngi.de>
arpi
parents:
5872
diff
changeset
|
50 #elif defined(hpux) |
ad967766679a
hpux DVD support fixes by Martin Gansser <mgansser@ngi.de>
arpi
parents:
5872
diff
changeset
|
51 # include <sun/scsi.h> |
4128
f22ecf05acea
patch by Steven M. Schultz to support dvd under BSD/OS
alex
parents:
4093
diff
changeset
|
52 #elif defined(__bsdi__) |
f22ecf05acea
patch by Steven M. Schultz to support dvd under BSD/OS
alex
parents:
4093
diff
changeset
|
53 # include <dvd.h> |
3975
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
54 #else |
1042
b333271f4e7c
Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents:
1018
diff
changeset
|
55 # error "Need the DVD ioctls" |
b333271f4e7c
Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents:
1018
diff
changeset
|
56 #endif |
492 | 57 |
3975
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
58 #include <dlfcn.h> |
492 | 59 #include "dvdauth.h" |
60 | |
1042
b333271f4e7c
Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents:
1018
diff
changeset
|
61 |
3975
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
62 // #if OLD_CSS_API |
1042
b333271f4e7c
Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents:
1018
diff
changeset
|
63 /* |
b333271f4e7c
Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents:
1018
diff
changeset
|
64 * provide some backward compatibiliy macros to compile this |
b333271f4e7c
Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents:
1018
diff
changeset
|
65 * code using the old libcss-0.1 |
b333271f4e7c
Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents:
1018
diff
changeset
|
66 */ |
b333271f4e7c
Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents:
1018
diff
changeset
|
67 #define DVDHandle int |
b333271f4e7c
Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents:
1018
diff
changeset
|
68 #define DVDOpenFailed (-1) |
b333271f4e7c
Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents:
1018
diff
changeset
|
69 |
b333271f4e7c
Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents:
1018
diff
changeset
|
70 #define DVDAuth(hdl, s) ioctl(hdl, DVD_AUTH, s) |
b333271f4e7c
Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents:
1018
diff
changeset
|
71 #define DVDOpenDevice(path) open(path, O_RDONLY) |
b333271f4e7c
Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents:
1018
diff
changeset
|
72 #define DVDCloseDevice(hdl) close(hdl) |
3975
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
73 // #define CSSDVDisEncrypted(hdl) CSSisEncrypted(hdl) |
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
74 // #define CSSDVDAuthDisc CSSAuthDisc |
1042
b333271f4e7c
Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents:
1018
diff
changeset
|
75 |
b333271f4e7c
Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents:
1018
diff
changeset
|
76 |
1018
e5fc7ec51fa3
-dvd is renamed to -dvdauth, variable dvd_device is renamed to dvd_auth_device. These changes are needed for future DVD playback developmenting
lgb
parents:
559
diff
changeset
|
77 char *dvd_auth_device=NULL; |
4228 | 78 extern char *dvd_device; |
1163
ac1341d4a2a7
According an idea, mplayer now can use external setuid root wrapper to do FIBMAP ioctl (requires root priv). Also, a serious bug was fixed in dvdauth.c made by some guy when mixing old and new style CSS API into dvdauth.c ;-)
lgb
parents:
1042
diff
changeset
|
79 char *dvd_raw_device=NULL; |
3975
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
80 char *css_so=NULL; |
492 | 81 unsigned char key_disc[2048]; |
82 unsigned char key_title[5]; | |
546 | 83 unsigned char *dvdimportkey=NULL; |
84 int descrambling=0; | |
492 | 85 |
7459
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
86 |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
87 static int css_so_is_loaded=0; |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
88 |
3975
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
89 static void *dlid; |
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
90 static int (*dl_CSSisEncrypted)(int); |
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
91 static int (*dl_CSSAuthDisc)(int,char *); |
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
92 static int (*dl_CSSAuthTitle)(int, char *,int); |
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
93 static int (*dl_CSSGetASF)(int); |
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
94 static int (*dl_CSSDecryptTitleKey)(char *, char *); |
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
95 static void (*dl_CSSDescramble)(u_char *, u_char *); |
492 | 96 |
7459
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
97 |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
98 void dvd_css_descramble ( u_char *sec , u_char *key ) |
3975
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
99 { |
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
100 (*dl_CSSDescramble)(sec,key); |
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
101 } |
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
102 |
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
103 |
1042
b333271f4e7c
Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents:
1018
diff
changeset
|
104 #ifdef __linux__ |
492 | 105 #include <linux/fs.h> |
106 | |
107 #ifndef FIBMAP | |
108 #define FIBMAP 1 | |
109 #endif | |
110 | |
3975
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
111 |
1042
b333271f4e7c
Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents:
1018
diff
changeset
|
112 static int path_to_lba (char *path) |
492 | 113 { |
1163
ac1341d4a2a7
According an idea, mplayer now can use external setuid root wrapper to do FIBMAP ioctl (requires root priv). Also, a serious bug was fixed in dvdauth.c made by some guy when mixing old and new style CSS API into dvdauth.c ;-)
lgb
parents:
1042
diff
changeset
|
114 int lba = 0; |
ac1341d4a2a7
According an idea, mplayer now can use external setuid root wrapper to do FIBMAP ioctl (requires root priv). Also, a serious bug was fixed in dvdauth.c made by some guy when mixing old and new style CSS API into dvdauth.c ;-)
lgb
parents:
1042
diff
changeset
|
115 char cmd[100]; |
ac1341d4a2a7
According an idea, mplayer now can use external setuid root wrapper to do FIBMAP ioctl (requires root priv). Also, a serious bug was fixed in dvdauth.c made by some guy when mixing old and new style CSS API into dvdauth.c ;-)
lgb
parents:
1042
diff
changeset
|
116 FILE *fp; |
1042
b333271f4e7c
Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents:
1018
diff
changeset
|
117 |
1163
ac1341d4a2a7
According an idea, mplayer now can use external setuid root wrapper to do FIBMAP ioctl (requires root priv). Also, a serious bug was fixed in dvdauth.c made by some guy when mixing old and new style CSS API into dvdauth.c ;-)
lgb
parents:
1042
diff
changeset
|
118 snprintf(cmd,sizeof(cmd),"fibmap_mplayer %s",path); |
ac1341d4a2a7
According an idea, mplayer now can use external setuid root wrapper to do FIBMAP ioctl (requires root priv). Also, a serious bug was fixed in dvdauth.c made by some guy when mixing old and new style CSS API into dvdauth.c ;-)
lgb
parents:
1042
diff
changeset
|
119 fp=popen(cmd,"r"); |
ac1341d4a2a7
According an idea, mplayer now can use external setuid root wrapper to do FIBMAP ioctl (requires root priv). Also, a serious bug was fixed in dvdauth.c made by some guy when mixing old and new style CSS API into dvdauth.c ;-)
lgb
parents:
1042
diff
changeset
|
120 if (fp) { |
ac1341d4a2a7
According an idea, mplayer now can use external setuid root wrapper to do FIBMAP ioctl (requires root priv). Also, a serious bug was fixed in dvdauth.c made by some guy when mixing old and new style CSS API into dvdauth.c ;-)
lgb
parents:
1042
diff
changeset
|
121 int ret; |
3700 | 122 memset(cmd,0,sizeof(cmd)); |
1163
ac1341d4a2a7
According an idea, mplayer now can use external setuid root wrapper to do FIBMAP ioctl (requires root priv). Also, a serious bug was fixed in dvdauth.c made by some guy when mixing old and new style CSS API into dvdauth.c ;-)
lgb
parents:
1042
diff
changeset
|
123 fgets(cmd,99,fp); |
3975
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
124 // printf("DVD: cmd: %s\n",cmd); |
1163
ac1341d4a2a7
According an idea, mplayer now can use external setuid root wrapper to do FIBMAP ioctl (requires root priv). Also, a serious bug was fixed in dvdauth.c made by some guy when mixing old and new style CSS API into dvdauth.c ;-)
lgb
parents:
1042
diff
changeset
|
125 if ((ret=pclose(fp))) |
3975
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
126 fprintf(stderr,"DVD: fibmap_mplayer: %s\n",*cmd?cmd:"no error info"); |
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
127 if (cmd[0]<'0'||cmd[0]>'9') fp=NULL; else { |
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
128 if(WIFEXITED(ret) && !WEXITSTATUS(ret)) { |
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
129 lba=atoi(cmd); |
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
130 printf("DVD: fibmap_mplayer is being used\n"); |
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
131 } else |
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
132 fp=NULL; |
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
133 } |
1042
b333271f4e7c
Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents:
1018
diff
changeset
|
134 } |
1163
ac1341d4a2a7
According an idea, mplayer now can use external setuid root wrapper to do FIBMAP ioctl (requires root priv). Also, a serious bug was fixed in dvdauth.c made by some guy when mixing old and new style CSS API into dvdauth.c ;-)
lgb
parents:
1042
diff
changeset
|
135 if (!fp) { |
ac1341d4a2a7
According an idea, mplayer now can use external setuid root wrapper to do FIBMAP ioctl (requires root priv). Also, a serious bug was fixed in dvdauth.c made by some guy when mixing old and new style CSS API into dvdauth.c ;-)
lgb
parents:
1042
diff
changeset
|
136 int fd; |
3975
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
137 printf("DVD: fibmap_mplayer could not run, trying with ioctl() ...\n"); |
1163
ac1341d4a2a7
According an idea, mplayer now can use external setuid root wrapper to do FIBMAP ioctl (requires root priv). Also, a serious bug was fixed in dvdauth.c made by some guy when mixing old and new style CSS API into dvdauth.c ;-)
lgb
parents:
1042
diff
changeset
|
138 if ((fd = open(path, O_RDONLY)) == -1) { |
3975
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
139 fprintf(stderr, "DVD: Cannot open file %s: %s", |
1163
ac1341d4a2a7
According an idea, mplayer now can use external setuid root wrapper to do FIBMAP ioctl (requires root priv). Also, a serious bug was fixed in dvdauth.c made by some guy when mixing old and new style CSS API into dvdauth.c ;-)
lgb
parents:
1042
diff
changeset
|
140 path ? path : "(NULL)", strerror(errno)); |
ac1341d4a2a7
According an idea, mplayer now can use external setuid root wrapper to do FIBMAP ioctl (requires root priv). Also, a serious bug was fixed in dvdauth.c made by some guy when mixing old and new style CSS API into dvdauth.c ;-)
lgb
parents:
1042
diff
changeset
|
141 return -1; |
ac1341d4a2a7
According an idea, mplayer now can use external setuid root wrapper to do FIBMAP ioctl (requires root priv). Also, a serious bug was fixed in dvdauth.c made by some guy when mixing old and new style CSS API into dvdauth.c ;-)
lgb
parents:
1042
diff
changeset
|
142 } |
ac1341d4a2a7
According an idea, mplayer now can use external setuid root wrapper to do FIBMAP ioctl (requires root priv). Also, a serious bug was fixed in dvdauth.c made by some guy when mixing old and new style CSS API into dvdauth.c ;-)
lgb
parents:
1042
diff
changeset
|
143 if (ioctl(fd, FIBMAP, &lba) != 0) { |
3975
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
144 perror("DVD: ioctl FIBMAP"); |
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
145 fprintf(stderr," Hint: run mplayer as root (or better to install fibmap_mplayer as suid root)!\n"); |
1163
ac1341d4a2a7
According an idea, mplayer now can use external setuid root wrapper to do FIBMAP ioctl (requires root priv). Also, a serious bug was fixed in dvdauth.c made by some guy when mixing old and new style CSS API into dvdauth.c ;-)
lgb
parents:
1042
diff
changeset
|
146 close(fd); |
ac1341d4a2a7
According an idea, mplayer now can use external setuid root wrapper to do FIBMAP ioctl (requires root priv). Also, a serious bug was fixed in dvdauth.c made by some guy when mixing old and new style CSS API into dvdauth.c ;-)
lgb
parents:
1042
diff
changeset
|
147 return -1; |
ac1341d4a2a7
According an idea, mplayer now can use external setuid root wrapper to do FIBMAP ioctl (requires root priv). Also, a serious bug was fixed in dvdauth.c made by some guy when mixing old and new style CSS API into dvdauth.c ;-)
lgb
parents:
1042
diff
changeset
|
148 } |
ac1341d4a2a7
According an idea, mplayer now can use external setuid root wrapper to do FIBMAP ioctl (requires root priv). Also, a serious bug was fixed in dvdauth.c made by some guy when mixing old and new style CSS API into dvdauth.c ;-)
lgb
parents:
1042
diff
changeset
|
149 close(fd); |
1042
b333271f4e7c
Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents:
1018
diff
changeset
|
150 } |
3975
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
151 printf("DVD: LBA: %d\n",lba); |
1042
b333271f4e7c
Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents:
1018
diff
changeset
|
152 return lba; |
492 | 153 } |
1163
ac1341d4a2a7
According an idea, mplayer now can use external setuid root wrapper to do FIBMAP ioctl (requires root priv). Also, a serious bug was fixed in dvdauth.c made by some guy when mixing old and new style CSS API into dvdauth.c ;-)
lgb
parents:
1042
diff
changeset
|
154 |
3975
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
155 #else /*linux*/ |
1163
ac1341d4a2a7
According an idea, mplayer now can use external setuid root wrapper to do FIBMAP ioctl (requires root priv). Also, a serious bug was fixed in dvdauth.c made by some guy when mixing old and new style CSS API into dvdauth.c ;-)
lgb
parents:
1042
diff
changeset
|
156 |
3975
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
157 static int path_to_lba (char *path) |
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
158 { |
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
159 #warning translating pathname to iso9660 LBA is not supported on this platform |
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
160 fprintf(stderr, "DVD: Translating pathname to iso9660 LBA is not supported on this platform\n"); |
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
161 return -1; |
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
162 } |
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
163 |
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
164 #endif /*linux*/ |
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
165 |
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
166 |
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
167 static int CSSDVDAuthTitlePath(DVDHandle hdl,unsigned char *key_title,char *path) |
1163
ac1341d4a2a7
According an idea, mplayer now can use external setuid root wrapper to do FIBMAP ioctl (requires root priv). Also, a serious bug was fixed in dvdauth.c made by some guy when mixing old and new style CSS API into dvdauth.c ;-)
lgb
parents:
1042
diff
changeset
|
168 { |
ac1341d4a2a7
According an idea, mplayer now can use external setuid root wrapper to do FIBMAP ioctl (requires root priv). Also, a serious bug was fixed in dvdauth.c made by some guy when mixing old and new style CSS API into dvdauth.c ;-)
lgb
parents:
1042
diff
changeset
|
169 int lba=path_to_lba(path); |
ac1341d4a2a7
According an idea, mplayer now can use external setuid root wrapper to do FIBMAP ioctl (requires root priv). Also, a serious bug was fixed in dvdauth.c made by some guy when mixing old and new style CSS API into dvdauth.c ;-)
lgb
parents:
1042
diff
changeset
|
170 if (lba==-1) return -1; |
3975
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
171 return (*dl_CSSAuthTitle)(hdl,key_title,lba); |
1163
ac1341d4a2a7
According an idea, mplayer now can use external setuid root wrapper to do FIBMAP ioctl (requires root priv). Also, a serious bug was fixed in dvdauth.c made by some guy when mixing old and new style CSS API into dvdauth.c ;-)
lgb
parents:
1042
diff
changeset
|
172 } |
ac1341d4a2a7
According an idea, mplayer now can use external setuid root wrapper to do FIBMAP ioctl (requires root priv). Also, a serious bug was fixed in dvdauth.c made by some guy when mixing old and new style CSS API into dvdauth.c ;-)
lgb
parents:
1042
diff
changeset
|
173 |
ac1341d4a2a7
According an idea, mplayer now can use external setuid root wrapper to do FIBMAP ioctl (requires root priv). Also, a serious bug was fixed in dvdauth.c made by some guy when mixing old and new style CSS API into dvdauth.c ;-)
lgb
parents:
1042
diff
changeset
|
174 |
492 | 175 |
1042
b333271f4e7c
Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents:
1018
diff
changeset
|
176 static void reset_agids ( DVDHandle dvd ) |
492 | 177 { |
4337 | 178 #if !defined(DVD_AUTH) && defined(DVDIOCREPORTKEY) |
179 struct dvd_authinfo ai; | |
180 int i; | |
181 for (i = 0; i < 4; i++) { | |
182 memset(&ai, 0, sizeof(ai)); | |
183 ai.format = DVD_INVALIDATE_AGID; | |
184 ai.agid = i; | |
185 ioctl(dvd, DVDIOCREPORTKEY, &ai); | |
186 } | |
187 #else | |
5872 | 188 #if defined(__OpenBSD__) |
189 union | |
190 #endif | |
492 | 191 dvd_authinfo ai; |
192 int i; | |
193 for (i = 0; i < 4; i++) { | |
194 memset(&ai, 0, sizeof(ai)); | |
195 ai.type = DVD_INVALIDATE_AGID; | |
196 ai.lsa.agid = i; | |
1042
b333271f4e7c
Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents:
1018
diff
changeset
|
197 DVDAuth(dvd, &ai); |
492 | 198 } |
4337 | 199 #endif |
492 | 200 } |
201 | |
202 | |
7459
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
203 static int dvd_load_css_so ( void ) |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
204 { |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
205 if (css_so_is_loaded) { |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
206 printf("DVD: warning: attempt to load css.so twice, ignoring.\n"); |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
207 return 0; |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
208 } |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
209 if (!css_so) css_so=strdup("libcss.so"); |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
210 printf("DVD: opening libcss.so as %s ...\n",css_so); |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
211 dlid=dlopen(css_so,RTLD_NOW); |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
212 if (!dlid) { |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
213 printf("DVD: dlopen: %s\n",dlerror()); |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
214 return 1; |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
215 } printf("DVD: dlopen OK!\n"); |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
216 |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
217 /* #ifdef __OpenBSD__ |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
218 #define CSS_DLSYM(v,s) if (!(v=dlsym(dlid,"_" s))) {\ |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
219 fprintf(stderr,"DVD: %s\n Hint: use libcss version 0.1!\n",dlerror());\ |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
220 return 1; } |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
221 #else |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
222 #define CSS_DLSYM(v,s) if (!(v=dlsym(dlid,s))) {\ |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
223 fprintf(stderr,"DVD: %s\n Hint: use libcss version 0.1!\n",dlerror());\ |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
224 return 1; } |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
225 #endif */ |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
226 |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
227 #define CSS_DLSYM(v,s) \ |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
228 if (!(v=dlsym(dlid,s))) {\ |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
229 if (!(v=dlsym(dlid,"_" s))) {\ |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
230 fprintf(stderr,"DVD: %s\n Hint: use libcss version 0.1!\n",dlerror());\ |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
231 return 1;\ |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
232 }\ |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
233 } |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
234 |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
235 |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
236 CSS_DLSYM(dl_CSSisEncrypted,"CSSisEncrypted"); |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
237 CSS_DLSYM(dl_CSSAuthDisc,"CSSAuthDisc"); |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
238 CSS_DLSYM(dl_CSSAuthTitle,"CSSAuthTitle"); |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
239 CSS_DLSYM(dl_CSSGetASF,"CSSGetASF"); |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
240 CSS_DLSYM(dl_CSSDecryptTitleKey,"CSSDecryptTitleKey"); |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
241 CSS_DLSYM(dl_CSSDescramble,"CSSDescramble"); |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
242 |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
243 #undef CSS_DLSYM |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
244 |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
245 css_so_is_loaded=1; |
7476 | 246 printf("DVD: shared object %s is loaded normally.\n",css_so); |
7459
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
247 return 0; |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
248 } |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
249 |
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
250 |
546 | 251 int dvd_import_key ( unsigned char *hexkey ) |
252 { | |
253 unsigned char *t=key_title; | |
254 int digit=4,len; | |
3700 | 255 memset(key_title,0,sizeof(key_title)); |
546 | 256 // printf("DVD key: %s\n",hexkey); |
257 for (len=0;len<10;len++) { | |
258 // printf("-> %c\n",*hexkey); | |
259 if (!*hexkey) return 1; | |
260 if (*hexkey>='A'&&*hexkey<='F') *t|=(*hexkey-'A'+10)<<digit; | |
261 else if (*hexkey>='0'&&*hexkey<='9') *t|=(*hexkey-'0')<<digit; | |
262 else return 1; | |
263 if (digit) digit=0; else { | |
264 digit=4; | |
265 t++; | |
266 } | |
267 hexkey++; | |
268 } | |
269 if (*hexkey) return 1; | |
3975
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
270 printf("DVD: DVD key (requested): %02X%02X%02X%02X%02X\n",key_title[0],key_title[1],key_title[2],key_title[3],key_title[4]); |
7459
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
271 if (dvd_load_css_so()) return 1; |
546 | 272 descrambling=1; |
273 return 0; | |
274 } | |
275 | |
492 | 276 |
559 | 277 |
1042
b333271f4e7c
Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents:
1018
diff
changeset
|
278 int dvd_auth ( char *dev , char *filename ) |
492 | 279 { |
1042
b333271f4e7c
Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents:
1018
diff
changeset
|
280 DVDHandle dvd; /* DVD device handle */ |
492 | 281 |
7459
9975a432cf47
fix segmentation fault with -dvdkey, fix return value of dvd_css_descramble(), try to load css.so syms with AND without _ in syms' names. PLEASE TEST IT CURRENTLY I HAVE NO DVD DRIVE NOR A SINGLE VOB FILE ...
lgb
parents:
7423
diff
changeset
|
282 if (dvd_load_css_so()) return 1; |
3975
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
283 |
1042
b333271f4e7c
Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents:
1018
diff
changeset
|
284 if ((dvd=DVDOpenDevice(dev)) == DVDOpenFailed) { |
1510
9ffe6c1a33b9
In case the open on the dvd device fails, print some hints based on errno
jkeil
parents:
1177
diff
changeset
|
285 fprintf(stderr,"DVD: cannot open DVD device \"%s\": %s.\n", |
9ffe6c1a33b9
In case the open on the dvd device fails, print some hints based on errno
jkeil
parents:
1177
diff
changeset
|
286 dev, strerror(errno)); |
492 | 287 return 1; |
288 } | |
3975
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
289 |
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
290 if (!(*dl_CSSisEncrypted)(dvd)) { |
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
291 printf("DVD: DVD is unencrypted! Skipping authentication!\n(note: you should not use -dvd switch for unencrypted discs!)\n"); |
1042
b333271f4e7c
Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents:
1018
diff
changeset
|
292 DVDCloseDevice(dvd); |
559 | 293 return 0; |
3975
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
294 } else printf("DVD: DVD is encrypted, issuing authentication ...\n"); |
492 | 295 /* reset AGIDs */ |
1042
b333271f4e7c
Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents:
1018
diff
changeset
|
296 reset_agids(dvd); |
492 | 297 /* authenticate disc */ |
3975
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
298 if ((*dl_CSSAuthDisc)(dvd,key_disc)) { |
1042
b333271f4e7c
Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents:
1018
diff
changeset
|
299 fprintf(stderr,"DVD: CSSDVDAuthDisc() failed.\n"); |
b333271f4e7c
Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents:
1018
diff
changeset
|
300 DVDCloseDevice(dvd); |
492 | 301 return 1; |
302 } | |
1042
b333271f4e7c
Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents:
1018
diff
changeset
|
303 if (CSSDVDAuthTitlePath(dvd,key_title,filename)) { |
b333271f4e7c
Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents:
1018
diff
changeset
|
304 fprintf(stderr,"DVD: CSSDVDAuthTitle() failed.\n"); |
b333271f4e7c
Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents:
1018
diff
changeset
|
305 DVDCloseDevice(dvd); |
492 | 306 return 1; |
307 } | |
308 | |
309 /* decrypting title */ | |
3975
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
310 if ((*dl_CSSDecryptTitleKey)(key_title, key_disc) < 0) { |
492 | 311 fprintf(stderr,"DVD: CSSDecryptTitleKey() failed.\n"); |
1042
b333271f4e7c
Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents:
1018
diff
changeset
|
312 DVDCloseDevice(dvd); |
492 | 313 return 1; |
314 } | |
315 | |
1042
b333271f4e7c
Solaris 8 DVD support and other fixes by Juergen Keil <jk@tools.de>
arpi_esp
parents:
1018
diff
changeset
|
316 DVDCloseDevice(dvd); |
3975
04b2227ab75a
Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
lgb
parents:
3700
diff
changeset
|
317 printf("DVD: DVD title key is: %02X%02X%02X%02X%02X\n",key_title[0],key_title[1],key_title[2],key_title[3],key_title[4]); |
546 | 318 descrambling=1; |
492 | 319 return 0; |
320 } | |
321 | |
322 | |
323 #endif |