summaryrefslogtreecommitdiff
path: root/cifs.idmap.c
AgeCommit message (Collapse)AuthorFilesLines
2012-11-09setcifsacl: don't freely cast between wbcDomainSid and cifs_sidJeff Layton1-3/+3
Since they are not necessarily aligned the same and potentially store their fields with different endianness. Copy from the wbcDomainSid to the cifs_sid as appropriate. Also rename the same function in cifs.idmap.c for consistency. Signed-off-by: Jeff Layton <jlayton@samba.org>
2012-11-07cifs.idmap: fix up some compile-time warningsJeff Layton1-12/+20
Get rid of some unused variables, and fix a strict-aliasing problem by copying the SID data to a new place instead of converting the endianness in-place. Signed-off-by: Jeff Layton <jlayton@samba.org>
2012-11-07cifs.idmap: fix endianness on SIDs before sending to kernelJeff Layton1-2/+21
Winbind keeps wbcDomainSids in host-endian format. They must be converted to little-endian before we can ship them off to the kernel. Signed-off-by: Jeff Layton <jlayton@samba.org>
2012-10-29cifs.idmap: add a --help option for cifs.idmapJeff Layton1-2/+8
To make it print the usage message and exit. Reviewed-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com> Signed-off-by: Jeff Layton <jlayton@samba.org>
2012-10-29cifs.idmap: set a timeout on keys that it instantiatesJeff Layton1-2/+23
...and add a command-line option to allow the admin to tune that value. I think this is a better way to handle this instead of trying to set the timeouts in kernel space. Reviewed-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com> Signed-off-by: Jeff Layton <jlayton@samba.org>
2012-10-29cifs.idmap: don't use atoi to convert unsigned int to numberJeff Layton1-6/+40
atoi() is for signed integers, and is deprecated in any case. Use strtoul() instead and check the result carefully before using it. Also add a log message when the string(s) can't be converted and fix the signedness of the types in other log messages. Reviewed-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com> Signed-off-by: Jeff Layton <jlayton@samba.org>
2012-10-29cifs.idmap: clean up strget and avoid memory allocationJeff Layton1-20/+14
Don't do a strlen() call if strstr() isn't going to match anyway. There's no need to duplicate the string here. None of the callers modify it, so just return a pointer into the original string. Reviewed-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com> Signed-off-by: Jeff Layton <jlayton@samba.org>
2012-10-29cifs.idmap: add an options struct to handle long optionsJeff Layton1-1/+6
...since the manpage advertises them. Reviewed-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com> Signed-off-by: Jeff Layton <jlayton@samba.org>
2012-10-29cifs.idmap: get rid of useless strcmp prior to idmappingJeff Layton1-2/+1
The code copies off the key description and then ensures that it's prefixed with "cifs.idmap". What's the point of that? Presumably request-key would never have called this otherwise. There's little harm in going ahead and doing the idmapping if this is called with the wrong string. Also, the error handling here is wrong. If the prefix doesn't match the code will exit 0 without doing any mapping. Just remove it. Reviewed-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com> Signed-off-by: Jeff Layton <jlayton@samba.org>
2011-10-19cifs.idmap: Add uid/gid to SID mapping functions (try #3)Shirish Pargaonkar1-0/+37
Add functions to map a uid and gid to a SID. These functions are similar to SID to uid and gid mapping functions. A SID is what is returned to the cifs module. Signed-off-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com>
2011-05-24cifs.idmap: remove 2 unused variablesJeff Layton1-2/+0
cifs.idmap.c: In function ‘cifs_idmap’: cifs.idmap.c:85:16: warning: unused variable ‘gr’ [-Wunused-variable] cifs.idmap.c:84:17: warning: unused variable ‘pw’ [-Wunused-variable] Signed-off-by: Jeff Layton <jlayton@samba.org>
2011-05-24cifs-utils: Create new binary cifs.idmap for sid to uid/gid mapping (try #4)Shirish Pargaonkar1-0/+197
Handle cifs.idmap type of key. Extract a SID string from the description and map it to either an uid or gid using winbind APIs. If that fails (e.g. because winbind is not installed/running or winbind returns an error), kernel assigns uid and gid (from mount superblock). Enable including winbind header files and idmapping code conditional to winbind devel rpms (header and library). An entry such as this create cifs.idmap * * /usr/sbin/cifs.idmap %k is needed in the file /etc/request-key.conf. [Note: Modified to not build new tool by default, and to fix up some whitespace munging] Modified-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com>