~lefteris-nikoltsios/+junk/samba-lp1016895

« back to all changes in this revision

Viewing changes to source3/registry/reg_backend_shares.c

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2011-12-21 13:18:04 UTC
  • mfrom: (0.39.21 sid)
  • Revision ID: package-import@ubuntu.com-20111221131804-xtlr39wx6njehxxr
Tags: 2:3.6.1-3ubuntu1
* Merge from Debian testing.  Remaining changes:
  + debian/patches/VERSION.patch:
    - set SAMBA_VERSION_SUFFIX to Ubuntu.
  + debian/patches/error-trans.fix-276472:
    - Add the translation of Unix Error code -ENOTSUP to NT Error Code
    - NT_STATUS_NOT_SUPPORTED to prevent the Permission denied error.
  + debian/smb.conf:
    - add "(Samba, Ubuntu)" to server string.
    - comment out the default [homes] share, and add a comment about
      "valid users = %S" to show users how to restrict access to
      \\server\username to only username.
    - Set 'usershare allow guests', so that usershare admins are 
      allowed to create public shares in addition to authenticated
      ones.
    - add map to guest = Bad user, maps bad username to guest access.
  + debian/samba-common.config:
    - Do not change priority to high if dhclient3 is installed.
    - Use priority medium instead of high for the workgroup question.
  + debian/control:
    - Don't build against or suggest ctdb.
    - Add dependency on samba-common-bin to samba.
  + Add ufw integration:
    - Created debian/samba.ufw.profile
    - debian/rules, debian/samba.dirs, debian/samba.files: install
      profile
    - debian/control: have samba suggest ufw
  + Add apport hook:
    - Created debian/source_samba.py.
    - debian/rules, debian/samba.dirs, debian/samba-common-bin.files: install
  + Switch to upstart:
    - Add debian/samba.{nmbd,smbd}.upstart.
  + debian/samba.logrotate, debian/samba-common.dhcp, debian/samba.if-up:
    - Make them upstart compatible
  + debian/samba.postinst: 
    - Avoid scary pdbedit warnings on first import.
  + debian/samba-common.postinst: Add more informative error message for
    the case where smb.conf was manually deleted
  + debian/patches/fix-debuglevel-name-conflict.patch: don't use 'debug_level'
    as a global variable name in an NSS module 
  + Dropped:
    - debian/patches/error-trans.fix-276472
    - debian/patches/fix-debuglevel-name-conflict.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
/* Implementation of registry virtual views for printing information */
21
21
 
22
22
#include "includes.h"
 
23
#include "registry.h"
 
24
#include "reg_objects.h"
23
25
 
24
26
#undef DBGC_CLASS
25
27
#define DBGC_CLASS DBGC_REGISTRY
26
28
 
27
29
/**********************************************************************
28
 
 It is safe to assume that every registry path passed into on of 
29
 
 the exported functions here begins with KEY_PRINTING else
 
30
 It is safe to assume that every registry path passed into one of
 
31
 the exported functions here begins with KEY_SHARES else
30
32
 these functions would have never been called.  This is a small utility
31
 
 function to strip the beginning of the path and make a copy that the 
 
33
 function to strip the beginning of the path and make a copy that the
32
34
 caller can modify.  Note that the caller is responsible for releasing
33
35
 the memory allocated here.
34
36
 **********************************************************************/
37
39
{
38
40
        const char *p;
39
41
        uint16 key_len = strlen(KEY_SHARES);
40
 
        
 
42
 
41
43
        /* 
42
44
         * sanity check...this really should never be True.
43
45
         * It is only here to prevent us from accessing outside
44
46
         * the path buffer in the extreme case.
45
47
         */
46
 
        
 
48
 
47
49
        if ( strlen(path) < key_len ) {
48
50
                DEBUG(0,("trim_reg_path: Registry path too short! [%s]\n", path));
49
51
                return NULL;
50
52
        }
51
 
        
52
 
        
 
53
 
53
54
        p = path + strlen( KEY_SHARES );
54
 
        
 
55
 
55
56
        if ( *p == '\\' )
56
57
                p++;
57
 
        
 
58
 
58
59
        if ( *p )
59
60
                return SMB_STRDUP(p);
60
61
        else
65
66
 Enumerate registry subkey names given a registry path.  
66
67
 Caller is responsible for freeing memory to **subkeys
67
68
 *********************************************************************/
68
 
 
 
69
 
69
70
static int shares_subkey_info( const char *key, struct regsubkey_ctr *subkey_ctr )
70
71
{
71
72
        char            *path;
72
73
        bool            top_level = False;
73
74
        int             num_subkeys = 0;
74
 
        
75
 
        DEBUG(10,("printing_subkey_info: key=>[%s]\n", key));
76
 
        
 
75
 
 
76
        DEBUG(10, ("shares_subkey_info: key=>[%s]\n", key));
 
77
 
77
78
        path = trim_reg_path( key );
78
 
        
 
79
 
79
80
        /* check to see if we are dealing with the top level key */
80
 
        
 
81
 
81
82
        if ( !path )
82
83
                top_level = True;
83
 
                
 
84
 
84
85
        if ( top_level ) {
85
86
                num_subkeys = 1;
86
87
                regsubkey_ctr_addkey( subkey_ctr, "Security" );
89
90
        else
90
91
                num_subkeys = handle_share_subpath( path, subkey_ctr, NULL );
91
92
#endif
92
 
        
 
93
 
93
94
        SAFE_FREE( path );
94
 
        
 
95
 
95
96
        return num_subkeys;
96
97
}
97
98
 
105
106
        char            *path;
106
107
        bool            top_level = False;
107
108
        int             num_values = 0;
108
 
        
109
 
        DEBUG(10,("printing_value_info: key=>[%s]\n", key));
110
 
        
 
109
 
 
110
        DEBUG(10, ("shares_value_info: key=>[%s]\n", key));
 
111
 
111
112
        path = trim_reg_path( key );
112
 
        
 
113
 
113
114
        /* check to see if we are dealing with the top level key */
114
 
        
 
115
 
115
116
        if ( !path )
116
117
                top_level = True;
117
 
        
 
118
 
118
119
        /* fill in values from the getprinterdata_printer_server() */
119
120
        if ( top_level )
120
121
                num_values = 0;
122
123
        else
123
124
                num_values = handle_printing_subpath( path, NULL, val );
124
125
#endif
125
 
                
 
126
 
126
127
        SAFE_FREE(path);
127
 
        
 
128
 
128
129
        return num_values;
129
130
}
130
131
 
131
132
/**********************************************************************
132
133
 Stub function which always returns failure since we don't want
133
 
 people storing printing information directly via regostry calls
 
134
 people storing share information directly via registry calls
134
135
 (for now at least)
135
136
 *********************************************************************/
136
137
 
141
142
 
142
143
/**********************************************************************
143
144
 Stub function which always returns failure since we don't want
144
 
 people storing printing information directly via regostry calls
 
145
 people storing share information directly via registry calls
145
146
 (for now at least)
146
147
 *********************************************************************/
147
148