~ubuntu-branches/ubuntu/vivid/samba/vivid

« back to all changes in this revision

Viewing changes to lib/util/byteorder.h

  • 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:
54
54
You do this:
55
55
 
56
56
#define CVAL(buf,pos) (((uint8_t *)(buf))[pos])
57
 
#define PVAL(buf,pos) ((uint_t)CVAL(buf,pos))
 
57
#define PVAL(buf,pos) ((unsigned int)CVAL(buf,pos))
58
58
#define SVAL(buf,pos) (PVAL(buf,pos)|PVAL(buf,(pos)+1)<<8)
59
59
 
60
60
then to extract a uint16_t value at offset 25 in a buffer you do this:
144
144
#define CAREFUL_ALIGNMENT 1
145
145
#endif
146
146
 
147
 
#define CVAL(buf,pos) ((uint_t)(((const uint8_t *)(buf))[pos]))
 
147
#define CVAL(buf,pos) ((unsigned int)(((const uint8_t *)(buf))[pos]))
148
148
#define CVAL_NC(buf,pos) (((uint8_t *)(buf))[pos]) /* Non-const version of CVAL */
149
149
#define PVAL(buf,pos) (CVAL(buf,pos))
150
150
#define SCVAL(buf,pos,val) (CVAL_NC(buf,pos) = (val))
185
185
 
186
186
/* get single value from an SMB buffer */
187
187
#define SVAL(buf,pos) (*(const uint16_t *)((const char *)(buf) + (pos)))
188
 
#define SVAL_NC(buf,pos) (*(uint16_t *)((char *)(buf) + (pos))) /* Non const version of above. */
 
188
#define SVAL_NC(buf,pos) (*(uint16_t *)((void *)((char *)(buf) + (pos)))) /* Non const version of above. */
189
189
#define IVAL(buf,pos) (*(const uint32_t *)((const char *)(buf) + (pos)))
190
 
#define IVAL_NC(buf,pos) (*(uint32_t *)((char *)(buf) + (pos))) /* Non const version of above. */
 
190
#define IVAL_NC(buf,pos) (*(uint32_t *)((void *)((char *)(buf) + (pos)))) /* Non const version of above. */
191
191
#define SVALS(buf,pos) (*(const int16_t *)((const char *)(buf) + (pos)))
192
 
#define SVALS_NC(buf,pos) (*(int16_t *)((char *)(buf) + (pos))) /* Non const version of above. */
 
192
#define SVALS_NC(buf,pos) (*(int16_t *)((void *)((char *)(buf) + (pos)))) /* Non const version of above. */
193
193
#define IVALS(buf,pos) (*(const int32_t *)((const char *)(buf) + (pos)))
194
 
#define IVALS_NC(buf,pos) (*(int32_t *)((char *)(buf) + (pos))) /* Non const version of above. */
 
194
#define IVALS_NC(buf,pos) (*(int32_t *)((void *)((char *)(buf) + (pos)))) /* Non const version of above. */
195
195
 
196
196
/* store single value in an SMB buffer */
197
197
#define SSVAL(buf,pos,val) SVAL_NC(buf,pos)=((uint16_t)(val))
201
201
 
202
202
#endif /* not CAREFUL_ALIGNMENT */
203
203
 
 
204
/* 64 bit macros */
 
205
#define BVAL(p, ofs) (IVAL(p,ofs) | (((uint64_t)IVAL(p,(ofs)+4)) << 32))
 
206
#define BVALS(p, ofs) ((int64_t)BVAL(p,ofs))
 
207
#define SBVAL(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), SIVAL(p,(ofs)+4,((uint64_t)(v))>>32))
 
208
#define SBVALS(p, ofs, v) (SBVAL(p,ofs,(uint64_t)v))
 
209
 
204
210
/* now the reverse routines - these are used in nmb packets (mostly) */
205
211
#define SREV(x) ((((x)&0xFF)<<8) | (((x)>>8)&0xFF))
206
212
#define IREV(x) ((SREV(x)<<16) | (SREV((x)>>16)))
 
213
#define BREV(x) ((IREV(x)<<32) | (IREV((x)>>32)))
207
214
 
208
215
#define RSVAL(buf,pos) SREV(SVAL(buf,pos))
209
216
#define RSVALS(buf,pos) SREV(SVALS(buf,pos))
210
217
#define RIVAL(buf,pos) IREV(IVAL(buf,pos))
211
218
#define RIVALS(buf,pos) IREV(IVALS(buf,pos))
 
219
#define RBVAL(buf,pos) BREV(BVAL(buf,pos))
 
220
#define RBVALS(buf,pos) BREV(BVALS(buf,pos))
212
221
#define RSSVAL(buf,pos,val) SSVAL(buf,pos,SREV(val))
213
222
#define RSSVALS(buf,pos,val) SSVALS(buf,pos,SREV(val))
214
223
#define RSIVAL(buf,pos,val) SIVAL(buf,pos,IREV(val))
215
224
#define RSIVALS(buf,pos,val) SIVALS(buf,pos,IREV(val))
 
225
#define RSBVAL(buf,pos,val) SBVAL(buf,pos,BREV(val))
 
226
#define RSBVALS(buf,pos,val) SBVALS(buf,pos,BREV(val))
216
227
 
217
228
/* Alignment macros. */
218
229
#define ALIGN4(p,base) ((p) + ((4 - (PTR_DIFF((p), (base)) & 3)) & 3))
222
233
/* macros for accessing SMB protocol elements */
223
234
#define VWV(vwv) ((vwv)*2)
224
235
 
225
 
/* 64 bit macros */
226
 
#define BVAL(p, ofs) (IVAL(p,ofs) | (((uint64_t)IVAL(p,(ofs)+4)) << 32))
227
 
#define BVALS(p, ofs) ((int64_t)BVAL(p,ofs))
228
 
#define SBVAL(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), SIVAL(p,(ofs)+4,((uint64_t)(v))>>32))
229
 
#define SBVALS(p, ofs, v) (SBVAL(p,ofs,(uint64_t)v))
230
 
 
231
236
#endif /* _BYTEORDER_H */