]> git.sesse.net Git - vlc/blob - src/misc/update.c
Update: make sure 1.1.0 > 1.1.0-git
[vlc] / src / misc / update.c
1 /*****************************************************************************
2  * update.c: VLC update checking and downloading
3  *****************************************************************************
4  * Copyright © 2005-2008 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Antoine Cellerier <dionoea -at- videolan -dot- org>
8  *          Rémi Duraffort <ivoire at via.ecp.fr>
9             Rafaël Carré <funman@videolanorg>
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either release 2 of the License, or
14  * (at your option) any later release.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
24  *****************************************************************************/
25
26 /**
27  *   \file
28  *   This file contains functions related to VLC update management
29  */
30
31 /*****************************************************************************
32  * Preamble
33  *****************************************************************************/
34
35 #ifdef HAVE_CONFIG_H
36 # include "config.h"
37 #endif
38
39 #include <vlc_common.h>
40 #include <vlc_update.h>
41
42 #ifdef UPDATE_CHECK
43
44 #include <assert.h>
45
46 #include <vlc_pgpkey.h>
47 #include <vlc_stream.h>
48 #include <vlc_strings.h>
49 #include <vlc_charset.h>
50 #include <vlc_dialog.h>
51
52 #include <gcrypt.h>
53 #include <vlc_gcrypt.h>
54
55 #include "update.h"
56 #include "../libvlc.h"
57
58 /*****************************************************************************
59  * Misc defines
60  *****************************************************************************/
61
62 /*
63  * Here is the format of these "status files" :
64  * First line is the last version: "X.Y.Ze" where:
65  *      * X is the major number
66  *      * Y is the minor number
67  *      * Z is the revision number
68  *      * e is an OPTIONAL extra letter
69  *      * AKA "0.8.6d" or "0.9.0"
70  * Second line is an url of the binary for this last version
71  * Remaining text is a required description of the update
72  */
73
74 #if defined( UNDER_CE )
75 #   define UPDATE_VLC_STATUS_URL "http://update.videolan.org/vlc/status-ce"
76 #elif defined( WIN32 )
77 #   define UPDATE_VLC_STATUS_URL "http://update.videolan.org/vlc/status-win-x86"
78 #elif defined( __APPLE__ )
79 #   if defined( __powerpc__ ) || defined( __ppc__ ) || defined( __ppc64__ )
80 #       define UPDATE_VLC_STATUS_URL "http://update.videolan.org/vlc/status-mac-ppc"
81 #   else
82 #       define UPDATE_VLC_STATUS_URL "http://update.videolan.org/vlc/status-mac-x86"
83 #   endif
84 #elif defined( SYS_BEOS )
85 #       define UPDATE_VLC_STATUS_URL "http://update.videolan.org/vlc/status-beos-x86"
86 #else
87 #   define UPDATE_VLC_STATUS_URL "http://update.videolan.org/vlc/status"
88 #endif
89
90
91 /*****************************************************************************
92  * Update_t functions
93  *****************************************************************************/
94
95 /**
96  * Create a new update VLC struct
97  *
98  * \param p_this the calling vlc_object
99  * \return pointer to new update_t or NULL
100  */
101 update_t *__update_New( vlc_object_t *p_this )
102 {
103     update_t *p_update;
104     assert( p_this );
105
106     p_update = (update_t *)malloc( sizeof( update_t ) );
107     if( !p_update ) return NULL;
108
109     vlc_mutex_init( &p_update->lock );
110
111     p_update->p_libvlc = p_this->p_libvlc;
112
113     p_update->release.psz_url = NULL;
114     p_update->release.psz_desc = NULL;
115
116     p_update->p_download = NULL;
117     p_update->p_check = NULL;
118
119     p_update->p_pkey = NULL;
120     vlc_gcrypt_init();
121
122     return p_update;
123 }
124
125 /**
126  * Delete an update_t struct
127  *
128  * \param p_update update_t* pointer
129  * \return nothing
130  */
131 void update_Delete( update_t *p_update )
132 {
133     assert( p_update );
134
135     if( p_update->p_check )
136     {
137         vlc_object_kill( p_update->p_check );
138         vlc_thread_join( p_update->p_check );
139         vlc_object_release( p_update->p_check );
140     }
141
142     if( p_update->p_download )
143     {
144         vlc_object_kill( p_update->p_download );
145         vlc_thread_join( p_update->p_download );
146         vlc_object_release( p_update->p_download );
147     }
148
149     vlc_mutex_destroy( &p_update->lock );
150
151     free( p_update->release.psz_url );
152     free( p_update->release.psz_desc );
153     free( p_update->p_pkey );
154
155     free( p_update );
156 }
157
158 /**
159  * Empty the release struct
160  *
161  * \param p_update update_t* pointer
162  * \return nothing
163  */
164 static void EmptyRelease( update_t *p_update )
165 {
166     p_update->release.i_major = 0;
167     p_update->release.i_minor = 0;
168     p_update->release.i_revision = 0;
169
170     FREENULL( p_update->release.psz_url );
171     FREENULL( p_update->release.psz_desc );
172 }
173
174 /**
175  * Get the update file and parse it
176  * p_update has to be locked when calling this function
177  *
178  * \param p_update pointer to update struct
179  * \return true if the update is valid and authenticated
180  */
181 static bool GetUpdateFile( update_t *p_update )
182 {
183     stream_t *p_stream = NULL;
184     int i_major = 0;
185     int i_minor = 0;
186     int i_revision = 0;
187     unsigned char extra;
188     char *psz_version_line = NULL;
189
190     p_stream = stream_UrlNew( p_update->p_libvlc, UPDATE_VLC_STATUS_URL );
191     if( !p_stream )
192     {
193         msg_Err( p_update->p_libvlc, "Failed to open %s for reading",
194                  UPDATE_VLC_STATUS_URL );
195         goto error;
196     }
197
198     /* Start reading the status file */
199     if( !( psz_version_line = stream_ReadLine( p_stream ) ) )
200     {
201         msg_Err( p_update->p_libvlc, "Update file %s is corrupted : missing version",
202                  UPDATE_VLC_STATUS_URL );
203         goto error;
204     }
205
206     /* first line : version number */
207     p_update->release.extra = 0;
208     switch( sscanf( psz_version_line, "%i.%i.%i%c",
209                     &i_major, &i_minor, &i_revision, &extra ) )
210     {
211         case 4:
212             p_update->release.extra = extra;
213         case 3:
214             p_update->release.i_major = i_major;
215             p_update->release.i_minor = i_minor;
216             p_update->release.i_revision = i_revision;
217             break;
218         default:
219             msg_Err( p_update->p_libvlc, "Update version false formated" );
220             goto error;
221     }
222
223     /* second line : URL */
224     if( !( p_update->release.psz_url = stream_ReadLine( p_stream ) ) )
225     {
226         msg_Err( p_update->p_libvlc, "Update file %s is corrupted : URL missing",
227                  UPDATE_VLC_STATUS_URL );
228         goto error;
229     }
230
231     /* Remaining data : description */
232     int i_read = stream_Size( p_stream ) - stream_Tell( p_stream );
233     if( i_read <= 0 )
234     {
235         msg_Err( p_update->p_libvlc,
236                 "Update file %s is corrupted: description missing",
237                 UPDATE_VLC_STATUS_URL );
238         goto error;
239     }
240
241     p_update->release.psz_desc = (char*) malloc( i_read + 1 );
242     if( !p_update->release.psz_desc )
243         goto error;
244
245     if( stream_Read( p_stream, p_update->release.psz_desc, i_read ) != i_read )
246     {
247         msg_Err( p_update->p_libvlc, "Couldn't download update file %s",
248                 UPDATE_VLC_STATUS_URL );
249         goto error;
250     }
251     p_update->release.psz_desc[i_read] = '\0';
252
253     stream_Delete( p_stream );
254     p_stream = NULL;
255
256     /* Now that we know the status is valid, we must download its signature
257      * to authenticate it */
258     signature_packet_t sign;
259     if( download_signature( VLC_OBJECT( p_update->p_libvlc ), &sign,
260             UPDATE_VLC_STATUS_URL ) != VLC_SUCCESS )
261     {
262         msg_Err( p_update->p_libvlc, "Couldn't download signature of status file" );
263         goto error;
264     }
265
266     if( sign.type != BINARY_SIGNATURE && sign.type != TEXT_SIGNATURE )
267     {
268         msg_Err( p_update->p_libvlc, "Invalid signature type" );
269         goto error;
270     }
271
272     p_update->p_pkey = (public_key_t*)malloc( sizeof( public_key_t ) );
273     if( !p_update->p_pkey )
274         goto error;
275
276     if( parse_public_key( videolan_public_key, sizeof( videolan_public_key ),
277                         p_update->p_pkey, NULL ) != VLC_SUCCESS )
278     {
279         msg_Err( p_update->p_libvlc, "Couldn't parse embedded public key, something went really wrong..." );
280         FREENULL( p_update->p_pkey );
281         goto error;
282     }
283
284     memcpy( p_update->p_pkey->longid, videolan_public_key_longid, 8 );
285
286     if( memcmp( sign.issuer_longid, p_update->p_pkey->longid , 8 ) != 0 )
287     {
288         msg_Dbg( p_update->p_libvlc, "Need to download the GPG key" );
289         public_key_t *p_new_pkey = download_key(
290                 VLC_OBJECT(p_update->p_libvlc),
291                 sign.issuer_longid, videolan_public_key_longid );
292         if( !p_new_pkey )
293         {
294             msg_Err( p_update->p_libvlc, "Couldn't download GPG key" );
295             FREENULL( p_update->p_pkey );
296             goto error;
297         }
298
299         uint8_t *p_hash = hash_sha1_from_public_key( p_new_pkey );
300         if( !p_hash )
301         {
302             msg_Err( p_update->p_libvlc, "Failed to hash signature" );
303             free( p_new_pkey );
304             FREENULL( p_update->p_pkey );
305             goto error;
306         }
307
308         if( verify_signature( p_new_pkey->sig.r, p_new_pkey->sig.s,
309                     &p_update->p_pkey->key, p_hash ) == VLC_SUCCESS )
310         {
311             free( p_hash );
312             msg_Info( p_update->p_libvlc, "Key authenticated" );
313             free( p_update->p_pkey );
314             p_update->p_pkey = p_new_pkey;
315         }
316         else
317         {
318             free( p_hash );
319             msg_Err( p_update->p_libvlc, "Key signature invalid !\n" );
320             goto error;
321         }
322     }
323
324     /* FIXME : read the status file all at once instead of line per line */
325     char *psz_text;
326     if( asprintf( &psz_text, "%s\n%s\n%s", psz_version_line,
327                 p_update->release.psz_url, p_update->release.psz_desc ) == -1 )
328     {
329         goto error;
330     }
331     FREENULL( psz_version_line );
332
333     uint8_t *p_hash = hash_sha1_from_text( psz_text, &sign );
334     if( !p_hash )
335     {
336         msg_Warn( p_update->p_libvlc, "Can't compute SHA1 hash for status file" );
337         goto error;
338     }
339
340     else if( p_hash[0] != sign.hash_verification[0] ||
341         p_hash[1] != sign.hash_verification[1] )
342     {
343         msg_Warn( p_update->p_libvlc, "Bad SHA1 hash for status file" );
344         goto error;
345     }
346
347     else if( verify_signature( sign.r, sign.s, &p_update->p_pkey->key, p_hash )
348             != VLC_SUCCESS )
349     {
350         msg_Err( p_update->p_libvlc, "BAD SIGNATURE for status file" );
351         goto error;
352     }
353
354     else
355     {
356         msg_Info( p_update->p_libvlc, "Status file authenticated" );
357         return true;
358     }
359
360 error:
361     if( p_stream )
362         stream_Delete( p_stream );
363     free( psz_version_line );
364     return false;
365 }
366
367 static void* update_CheckReal( vlc_object_t *p_this );
368
369 /**
370  * Check for updates
371  *
372  * \param p_update pointer to update struct
373  * \param pf_callback pointer to a function to call when the update_check is finished
374  * \param p_data pointer to some datas to give to the callback
375  * \returns nothing
376  */
377 void update_Check( update_t *p_update, void (*pf_callback)( void*, bool ), void *p_data )
378 {
379     assert( p_update );
380
381     // If the object already exist, destroy it
382     if( p_update->p_check )
383     {
384         vlc_object_kill( p_update->p_check );
385         vlc_thread_join( p_update->p_check );
386         vlc_object_release( p_update->p_check );
387     }
388
389     update_check_thread_t *p_uct =
390         vlc_custom_create( p_update->p_libvlc, sizeof( *p_uct ),
391                            VLC_OBJECT_GENERIC, "update check" );
392     if( !p_uct ) return;
393
394     p_uct->p_update = p_update;
395     p_update->p_check = p_uct;
396     p_uct->pf_callback = pf_callback;
397     p_uct->p_data = p_data;
398
399     vlc_thread_create( p_uct, "check for update", update_CheckReal,
400                        VLC_THREAD_PRIORITY_LOW );
401 }
402
403 void* update_CheckReal( vlc_object_t* p_this )
404 {
405     update_check_thread_t *p_uct = (update_check_thread_t *)p_this;
406     bool b_ret;
407     int canc;
408
409     canc = vlc_savecancel ();
410     vlc_mutex_lock( &p_uct->p_update->lock );
411
412     EmptyRelease( p_uct->p_update );
413     b_ret = GetUpdateFile( p_uct->p_update );
414     vlc_mutex_unlock( &p_uct->p_update->lock );
415
416     if( p_uct->pf_callback )
417         (p_uct->pf_callback)( p_uct->p_data, b_ret );
418
419     vlc_restorecancel (canc);
420     return NULL;
421 }
422
423 /**
424  * Compare a given release's version number to the current VLC's one
425  *
426  * \param p_update structure
427  * \return true if we have to upgrade to the given version to be up to date
428  */
429 static bool is_strictly_greater( int * a, int * b, int n)
430 {
431     if( n <= 0 ) return false;
432     if(a[0] > b[0] ) return true;
433     if(a[0] == b[0] ) return is_strictly_greater( a+1, b+1, n-1 );
434     /* a[0] < b[0] */ return false;
435 }
436
437 bool update_NeedUpgrade( update_t *p_update )
438 {
439     assert( p_update );
440
441     int current_version[] = {
442         *PACKAGE_VERSION_MAJOR - '0',
443         *PACKAGE_VERSION_MINOR - '0',
444         *PACKAGE_VERSION_REVISION - '0',
445         /* extra string of development versions is "-git", "-rc" ..
446          * so make sure version a.b.c is newer than a.b.c-XXX */
447         (*PACKAGE_VERSION_EXTRA == '-') ? -1 : *PACKAGE_VERSION_EXTRA
448     };
449     int latest_version[] = {
450         p_update->release.i_major,
451         p_update->release.i_minor,
452         p_update->release.i_revision,
453         p_update->release.extra
454     };
455
456     return is_strictly_greater( latest_version, current_version, 4 );
457 }
458
459 /**
460  * Convert a long int size in bytes to a string
461  *
462  * \param l_size the size in bytes
463  * \return the size as a string
464  */
465 static char *size_str( long int l_size )
466 {
467     char *psz_tmp = NULL;
468     int i_retval = 0;
469     if( l_size >> 30 )
470         i_retval = asprintf( &psz_tmp, _("%.1f GB"), (float)l_size/(1<<30) );
471     else if( l_size >> 20 )
472         i_retval = asprintf( &psz_tmp, _("%.1f MB"), (float)l_size/(1<<20) );
473     else if( l_size >> 10 )
474         i_retval = asprintf( &psz_tmp, _("%.1f kB"), (float)l_size/(1<<10) );
475     else
476         i_retval = asprintf( &psz_tmp, _("%ld B"), l_size );
477
478     return i_retval == -1 ? NULL : psz_tmp;
479 }
480
481 static void* update_DownloadReal( vlc_object_t *p_this );
482
483 /**
484  * Download the file given in the update_t
485  *
486  * \param p_update structure
487  * \param dir to store the download file
488  * \return nothing
489  */
490 void update_Download( update_t *p_update, const char *psz_destdir )
491 {
492     assert( p_update );
493
494     // If the object already exist, destroy it
495     if( p_update->p_download )
496     {
497         vlc_object_kill( p_update->p_download );
498         vlc_thread_join( p_update->p_download );
499         vlc_object_release( p_update->p_download );
500     }
501
502     update_download_thread_t *p_udt =
503         vlc_custom_create( p_update->p_libvlc, sizeof( *p_udt ),
504                            VLC_OBJECT_GENERIC, "update download" );
505     if( !p_udt )
506         return;
507
508     p_udt->p_update = p_update;
509     p_update->p_download = p_udt;
510     p_udt->psz_destdir = psz_destdir ? strdup( psz_destdir ) : NULL;
511
512     vlc_thread_create( p_udt, "download update", update_DownloadReal,
513                        VLC_THREAD_PRIORITY_LOW );
514 }
515
516 static void* update_DownloadReal( vlc_object_t *p_this )
517 {
518     update_download_thread_t *p_udt = (update_download_thread_t *)p_this;
519     dialog_progress_bar_t *p_progress = NULL;
520     long int l_size;
521     long int l_downloaded = 0;
522     float f_progress;
523     char *psz_status = NULL;
524     char *psz_downloaded = NULL;
525     char *psz_size = NULL;
526     char *psz_destfile = NULL;
527     char *psz_tmpdestfile = NULL;
528
529     FILE *p_file = NULL;
530     stream_t *p_stream = NULL;
531     void* p_buffer = NULL;
532     int i_read;
533     int canc;
534
535     update_t *p_update = p_udt->p_update;
536     char *psz_destdir = p_udt->psz_destdir;
537
538     msg_Dbg( p_udt, "Opening Stream '%s'", p_update->release.psz_url );
539     canc = vlc_savecancel ();
540
541     /* Open the stream */
542     p_stream = stream_UrlNew( p_udt, p_update->release.psz_url );
543     if( !p_stream )
544     {
545         msg_Err( p_udt, "Failed to open %s for reading", p_update->release.psz_url );
546         goto end;
547     }
548
549     /* Get the stream size */
550     l_size = stream_Size( p_stream );
551
552     /* Get the file name and open it*/
553     psz_tmpdestfile = strrchr( p_update->release.psz_url, '/' );
554     if( !psz_tmpdestfile )
555     {
556         msg_Err( p_udt, "The URL %s is badly formated",
557                  p_update->release.psz_url );
558         goto end;
559     }
560     psz_tmpdestfile++;
561     if( asprintf( &psz_destfile, "%s%s", psz_destdir, psz_tmpdestfile ) == -1 )
562         goto end;
563
564     p_file = utf8_fopen( psz_destfile, "w" );
565     if( !p_file )
566     {
567         msg_Err( p_udt, "Failed to open %s for writing", psz_destfile );
568         dialog_FatalWait( p_udt, _("Saving file failed"),
569             _("Failed to open \"%s\" for writing"),
570              psz_destfile );
571         goto end;
572     }
573
574     /* Create a buffer and fill it with the downloaded file */
575     p_buffer = (void *)malloc( 1 << 10 );
576     if( !p_buffer )
577     {
578         msg_Err( p_udt, "Can't malloc (1 << 10) bytes! download cancelled." );
579         goto end;
580     }
581
582     msg_Dbg( p_udt, "Downloading Stream '%s'", p_update->release.psz_url );
583
584     psz_size = size_str( l_size );
585     if( asprintf( &psz_status, _("%s\nDownloading... %s/%s %.1f%% done"),
586         p_update->release.psz_url, "0.0", psz_size, 0.0 ) != -1 )
587     {
588         p_progress = dialog_ProgressCreate( p_udt, _( "Downloading ..."),
589                                             psz_status, _("Cancel") );
590         free( psz_status );
591     }
592
593     while( vlc_object_alive( p_udt ) &&
594            ( i_read = stream_Read( p_stream, p_buffer, 1 << 10 ) ) &&
595            !dialog_ProgressCancelled( p_progress ) )
596     {
597         if( fwrite( p_buffer, i_read, 1, p_file ) < 1 )
598         {
599             msg_Err( p_udt, "Failed to write into %s", psz_destfile );
600             break;
601         }
602
603         l_downloaded += i_read;
604         psz_downloaded = size_str( l_downloaded );
605         f_progress = (float)l_downloaded/(float)l_size;
606
607         if( asprintf( &psz_status, _( "%s\nDownloading... %s/%s - %.1f%% done" ),
608                       p_update->release.psz_url, psz_downloaded, psz_size,
609                       f_progress*100 ) != -1 )
610         {
611             dialog_ProgressSet( p_progress, psz_status, f_progress );
612             free( psz_status );
613         }
614         free( psz_downloaded );
615     }
616
617     /* Finish the progress bar or delete the file if the user had canceled */
618     fclose( p_file );
619     p_file = NULL;
620
621     if( vlc_object_alive( p_udt ) &&
622         !dialog_ProgressCancelled( p_progress ) )
623     {
624         if( asprintf( &psz_status, _("%s\nDone %s (100.0%%)"),
625             p_update->release.psz_url, psz_size ) != -1 )
626         {
627             dialog_ProgressDestroy( p_progress );
628             p_progress = NULL;
629             free( psz_status );
630         }
631     }
632     else
633     {
634         utf8_unlink( psz_destfile );
635         goto end;
636     }
637
638     signature_packet_t sign;
639     if( download_signature( VLC_OBJECT( p_udt ), &sign,
640             p_update->release.psz_url ) != VLC_SUCCESS )
641     {
642         utf8_unlink( psz_destfile );
643
644         dialog_FatalWait( p_udt, _("File could not be verified"),
645             _("It was not possible to download a cryptographic signature for "
646               "the downloaded file \"%s\". Thus, it was deleted."),
647             psz_destfile );
648         msg_Err( p_udt, "Couldn't download signature of downloaded file" );
649         goto end;
650     }
651
652     if( memcmp( sign.issuer_longid, p_update->p_pkey->longid, 8 ) )
653     {
654         utf8_unlink( psz_destfile );
655         msg_Err( p_udt, "Invalid signature issuer" );
656         dialog_FatalWait( p_udt, _("Invalid signature"),
657             _("The cryptographic signature for the downloaded file \"%s\" was "
658               "invalid and could not be used to securely verify it. Thus, the "
659               "file was deleted."),
660             psz_destfile );
661         goto end;
662     }
663
664     if( sign.type != BINARY_SIGNATURE )
665     {
666         utf8_unlink( psz_destfile );
667         msg_Err( p_udt, "Invalid signature type" );
668         dialog_FatalWait( p_udt, _("Invalid signature"),
669             _("The cryptographic signature for the downloaded file \"%s\" was "
670               "invalid and could not be used to securely verify it. Thus, the "
671               "file was deleted."),
672             psz_destfile );
673         goto end;
674     }
675
676     uint8_t *p_hash = hash_sha1_from_file( psz_destfile, &sign );
677     if( !p_hash )
678     {
679         msg_Err( p_udt, "Unable to hash %s", psz_destfile );
680         utf8_unlink( psz_destfile );
681         dialog_FatalWait( p_udt, _("File not verifiable"),
682             _("It was not possible to securely verify the downloaded file"
683               " \"%s\". Thus, it was deleted."),
684             psz_destfile );
685
686         goto end;
687     }
688
689     if( p_hash[0] != sign.hash_verification[0] ||
690         p_hash[1] != sign.hash_verification[1] )
691     {
692         utf8_unlink( psz_destfile );
693         dialog_FatalWait( p_udt, _("File corrupted"),
694             _("Downloaded file \"%s\" was corrupted. Thus, it was deleted."),
695              psz_destfile );
696         msg_Err( p_udt, "Bad SHA1 hash for %s", psz_destfile );
697         free( p_hash );
698         goto end;
699     }
700
701     if( verify_signature( sign.r, sign.s, &p_update->p_pkey->key, p_hash )
702             != VLC_SUCCESS )
703     {
704         utf8_unlink( psz_destfile );
705         dialog_FatalWait( p_udt, _("File corrupted"),
706             _("Downloaded file \"%s\" was corrupted. Thus, it was deleted."),
707              psz_destfile );
708         msg_Err( p_udt, "BAD SIGNATURE for %s", psz_destfile );
709         free( p_hash );
710         goto end;
711     }
712
713     msg_Info( p_udt, "%s authenticated", psz_destfile );
714     free( p_hash );
715
716 end:
717     if( p_progress )
718         dialog_ProgressDestroy( p_progress );
719     if( p_stream )
720         stream_Delete( p_stream );
721     if( p_file )
722         fclose( p_file );
723     free( psz_destdir );
724     free( psz_destfile );
725     free( p_buffer );
726     free( psz_size );
727
728     vlc_restorecancel( canc );
729     return NULL;
730 }
731
732 update_release_t *update_GetRelease( update_t *p_update )
733 {
734     return &p_update->release;
735 }
736
737 #else
738 update_t *__update_New( vlc_object_t *p_this )
739 {
740     (void)p_this;
741     return NULL;
742 }
743
744 void update_Delete( update_t *p_update )
745 {
746     (void)p_update;
747 }
748
749 void update_Check( update_t *p_update, void (*pf_callback)( void*, bool ),
750                    void *p_data )
751 {
752     (void)p_update; (void)pf_callback; (void)p_data;
753 }
754
755 bool update_NeedUpgrade( update_t *p_update )
756 {
757     (void)p_update;
758     return false;
759 }
760
761 void update_Download( update_t *p_update, const char *psz_destdir )
762 {
763     (void)p_update; (void)psz_destdir;
764 }
765
766 update_release_t *update_GetRelease( update_t *p_update )
767 {
768     (void)p_update;
769     return NULL;
770 }
771 #endif