~ubuntu-branches/ubuntu/gutsy/samba/gutsy-updates

« back to all changes in this revision

Viewing changes to source/client/mount.cifs.c

  • Committer: Bazaar Package Importer
  • Author(s): Andrew Mitchell
  • Date: 2006-11-28 20:14:37 UTC
  • mfrom: (0.10.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20061128201437-a6x4lzlhempazocp
Tags: 3.0.23d-1ubuntu1
* Merge from debian unstable.
* Drop python2.4-samba, replace with python-samba. Added Conflicts/Replaces
  on python2.4-samba
* Drop track-connection-dos.patch, ubuntu-winbind-panic.patch, 
  ubuntu-fix-ldap.patch, ubuntu-setlocale.patch, ubuntu-setlocale-fixes.patch
* Remaining Ubuntu changes:
  - Revert Debian's installation of mount.cifs and umount.cifs as suid
  - Comment out the default [homes] shares and add more verbose comments to
    explain what they do and how they work (closes: launchpad.net/27608)
  - Add a "valid users = %S" stanza to the commented-out [homes] section, to
    show users how to restrict access to \\server\username to only username.
  - Change the (commented-out) "printer admin" example to use "@lpadmin"
    instead of "@ntadmin", since the lpadmin group is used for spool admin.
  - Alter the panic-action script to encourage users to report their
    bugs in Ubuntu packages to Ubuntu, rather than reporting to Debian.
    Modify text to more closely match the Debian script
  - Munge our init script to deal with the fact that our implementation
    (or lack thereof) of log_daemon_msg and log_progress_msg differs
    from Debian's implementation of the same (Ubuntu #19691)
  - Kept ubuntu-auxsrc.patch: some auxilliary sources (undocumented in 
    previous changelogs)
  - Set default workgroup to MSHOME

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
#define MOUNT_CIFS_VERSION_MINOR "10"
44
44
 
45
45
#ifndef MOUNT_CIFS_VENDOR_SUFFIX
46
 
#define MOUNT_CIFS_VENDOR_SUFFIX ""
47
 
#endif
 
46
 #ifdef _SAMBA_BUILD_
 
47
  #include "include/version.h"
 
48
  #ifdef SAMBA_VERSION_VENDOR_SUFFIX
 
49
   #define MOUNT_CIFS_VENDOR_SUFFIX "-"SAMBA_VERSION_OFFICIAL_STRING"-"SAMBA_VERSION_VENDOR_SUFFIX
 
50
  #else
 
51
   #define MOUNT_CIFS_VENDOR_SUFFIX "-"SAMBA_VERSION_OFFICIAL_STRING
 
52
  #endif /* SAMBA_VERSION_OFFICIAL_STRING and SAMBA_VERSION_VENDOR_SUFFIX */
 
53
 #else
 
54
   #define MOUNT_CIFS_VENDOR_SUFFIX ""
 
55
 #endif /* _SAMBA_BUILD_ */
 
56
#endif /* MOUNT_CIFS_VENDOR_SUFFIX */
48
57
 
49
58
#ifndef MS_MOVE 
50
59
#define MS_MOVE 8192 
51
60
#endif 
52
61
 
53
 
char * thisprogram;
 
62
#define CONST_DISCARD(type, ptr)      ((type) ((void *) (ptr)))
 
63
 
 
64
const char *thisprogram;
54
65
int verboseflag = 0;
55
66
static int got_password = 0;
56
67
static int got_user = 0;
248
259
        else 
249
260
                memset(mountpassword, 0, 64);
250
261
 
 
262
        if (mountpassword == NULL) {
 
263
                printf("malloc failed\n");
 
264
                exit(1);
 
265
        }
 
266
 
251
267
        if(filename != NULL) {
252
268
                file_descript = open(filename, O_RDONLY);
253
269
                if(file_descript < 0) {
292
308
 
293
309
static int parse_options(char ** optionsp, int * filesys_flags)
294
310
{
295
 
        char * data;
 
311
        const char * data;
296
312
        char * percent_char = NULL;
297
313
        char * value = NULL;
298
314
        char * next_keyword = NULL;
745
761
 
746
762
        if(length < 3) {
747
763
                /* BB add code to find DFS root here */
748
 
                printf("\nMounting the DFS root for domain not implemented yet");
 
764
                printf("\nMounting the DFS root for domain not implemented yet\n");
749
765
                return NULL;
750
766
        } else {
751
767
                if(strncmp(unc_name,"//",2) && strncmp(unc_name,"\\\\",2)) {
852
868
        char * share_name = NULL;
853
869
        char * ipaddr = NULL;
854
870
        char * uuid = NULL;
855
 
        char * mountpoint;
 
871
        char * mountpoint = NULL;
856
872
        char * options;
857
873
        char * resolved_path;
858
874
        char * temp;
876
892
 
877
893
        if(argc && argv) {
878
894
                thisprogram = argv[0];
 
895
        } else {
 
896
                mount_cifs_usage();
 
897
                exit(1);
879
898
        }
 
899
 
880
900
        if(thisprogram == NULL)
881
901
                thisprogram = "mount.cifs";
882
902
 
886
906
/* #ifdef _GNU_SOURCE
887
907
        printf(" node: %s machine: %s sysname %s domain %s\n", sysinfo.nodename,sysinfo.machine,sysinfo.sysname,sysinfo.domainname);
888
908
#endif */
889
 
 
890
 
        share_name = argv[1];
891
 
        mountpoint = argv[2];
 
909
        if(argc > 2) {
 
910
                share_name = argv[1];
 
911
                mountpoint = argv[2];
 
912
        }
892
913
 
893
914
        /* add sharename in opts string as unc= parm */
894
915
 
1017
1038
                }
1018
1039
        }
1019
1040
 
1020
 
        if(argc < 3)
 
1041
        if((argc < 3) || (share_name == NULL) || (mountpoint == NULL)) {
1021
1042
                mount_cifs_usage();
 
1043
                exit(1);
 
1044
        }
1022
1045
 
1023
1046
        if (getenv("PASSWD")) {
1024
1047
                if(mountpassword == NULL)
1099
1122
                optlen += strlen(share_name) + 4;
1100
1123
        else {
1101
1124
                printf("No server share name specified\n");
 
1125
                printf("\nMounting the DFS root for server not implemented yet\n");
 
1126
                exit(1);
1102
1127
        }
1103
1128
        if(user_name)
1104
1129
                optlen += strlen(user_name) + 6;
1197
1222
                if(pmntfile) {
1198
1223
                        mountent.mnt_fsname = share_name;
1199
1224
                        mountent.mnt_dir = mountpoint; 
1200
 
                        mountent.mnt_type = "cifs"; 
 
1225
                        mountent.mnt_type = CONST_DISCARD(char *,"cifs"); 
1201
1226
                        mountent.mnt_opts = malloc(220);
1202
1227
                        if(mountent.mnt_opts) {
1203
1228
                                char * mount_user = getusername();