diff options
author | Gerald Carter <jerry@samba.org> | 2004-10-25 19:25:54 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2004-10-25 19:25:54 +0000 |
commit | 317ab676bf28d3922dc0fba02e908a766035872f (patch) | |
tree | d9ea00a371f92740e58b95991b4b56723454304d | |
parent | 943c0aaaeb5a24a9501a164e9a765384e8e8a2ff (diff) | |
download | samba-317ab676bf28d3922dc0fba02e908a766035872f.tar.gz samba-317ab676bf28d3922dc0fba02e908a766035872f.tar.xz samba-317ab676bf28d3922dc0fba02e908a766035872f.zip |
r3220: merging current 3.0 code to release branch
132 files changed, 4334 insertions, 2476 deletions
diff --git a/examples/LDAP/samba-nds.schema b/examples/LDAP/samba-nds.schema index 8369c8404ec..c623b4da675 100644 --- a/examples/LDAP/samba-nds.schema +++ b/examples/LDAP/samba-nds.schema @@ -1,151 +1,310 @@ ## -## Schema file for Novell eDirectory 8.7.x by Uli Iske -## Schema for storing Samba's smbpasswd file in LDAP +## Schema file for Novell eDirectory by Uli Iske +## Schema for storing Samba user accounts and group maps in LDAP +## OIDs are owned by the Samba Team +## +## Prerequisite schemas rfc2307-usergroup.ldif +## +## 1.3.6.1.4.1.7165.2.1.x - attributetypes +## 1.3.6.1.4.1.7165.2.2.x - objectclasses +## ## OIDs are owned by the Samba Team ## ####################################################################### ## Attributes used by Samba 3.0 schema ## ####################################################################### +## +## Password hashes +## + +dn: cn=schema +changetype: modify +add: attributetypes +attributeTypes: ( 1.3.6.1.4.1.7165.2.1.24 NAME 'sambaLMPassword' DESC 'LanManager Password' EQUALITY caseIgnoreIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{32} SINGLE-VALUE ) + +dn: cn=schema +changetype: modify +add: attributetypes +attributeTypes: ( 1.3.6.1.4.1.7165.2.1.25 NAME 'sambaNTPassword' DESC 'MD4 hash of the unicode password' EQUALITY caseIgnoreIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{32} SINGLE-VALUE ) + +## +## Account flags in string format ((UWDX ]) +## + +dn: cn=schema +changetype: modify +add: attributetypes +attributeTypes: ( 1.3.6.1.4.1.7165.2.1.26 NAME 'sambaAcctFlags' DESC 'Account Flags' EQUALITY caseIgnoreIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{16} SINGLE-VALUE ) + +## +## Password timestamps & policies +## + +dn: cn=schema +changetype: modify +add: attributetypes +attributeTypes: ( 1.3.6.1.4.1.7165.2.1.27 NAME 'sambaPwdLastSet' DESC 'Timestamp of the last password update' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE ) + +dn: cn=schema +changetype: modify +add: attributetypes +attributeTypes: ( 1.3.6.1.4.1.7165.2.1.28 NAME 'sambaPwdCanChange' DESC 'Timestamp of when the user is allowed to update the password' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE ) + +dn: cn=schema +changetype: modify +add: attributetypes +attributeTypes: ( 1.3.6.1.4.1.7165.2.1.29 NAME 'sambaPwdMustChange' DESC 'Timestamp of when the password will expire' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE ) + +dn: cn=schema +changetype: modify +add: attributetypes +attributeTypes: ( 1.3.6.1.4.1.7165.2.1.30 NAME 'sambaLogonTime' DESC 'Timestamp of last logon' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE ) + +dn: cn=schema +changetype: modify +add: attributetypes +attributeTypes: ( 1.3.6.1.4.1.7165.2.1.31 NAME 'sambaLogoffTime' DESC 'Timestamp of last logoff' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE ) + +dn: cn=schema +changetype: modify +add: attributetypes +attributeTypes: ( 1.3.6.1.4.1.7165.2.1.32 NAME 'sambaKickoffTime' DESC 'Timestamp of when the user will be logged off automatically' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE ) + +dn: cn=schema +changetype: modify +add: attributetypes +attributeTypes: ( 1.3.6.1.4.1.7165.2.1.48 NAME 'sambaBadPasswordCount' DESC 'Bad password attempt count' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE ) + +dn: cn=schema +changetype: modify +add: attributetypes +attributeTypes: ( 1.3.6.1.4.1.7165.2.1.49 NAME 'sambaBadPasswordTime' DESC 'Time of the last bad password attempt' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE ) + +dn: cn=schema +changetype: modify +add: attributetypes +attributeTypes: ( 1.3.6.1.4.1.7165.2.1.55 NAME 'sambaLogonHours' DESC 'Logon Hours' EQUALITY caseIgnoreIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE ) + +## +## String settings +## + +dn: cn=schema +changetype: modify +add: attributetypes +attributeTypes: ( 1.3.6.1.4.1.7165.2.1.33 NAME 'sambaHomeDrive' DESC 'Driver letter of home directory mapping' EQUALITY caseIgnoreIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{4} SINGLE-VALUE ) + dn: cn=schema changetype: modify add: attributetypes -attributeTypes: ( 1.3.6.1.4.1.7165.2.1.24 NAME 'sambaLMPassword' DESC 'LanManager Password' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE ) +attributeTypes: ( 1.3.6.1.4.1.7165.2.1.34 NAME 'sambaLogonScript' DESC 'Logon script path' EQUALITY caseIgnoreMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{255} SINGLE-VALUE ) dn: cn=schema changetype: modify add: attributetypes -attributeTypes: ( 1.3.6.1.4.1.7165.2.1.25 NAME 'sambaNTPassword' DESC 'MD4 hash of the unicode password' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE ) +attributeTypes: ( 1.3.6.1.4.1.7165.2.1.35 NAME 'sambaProfilePath' DESC 'Roaming profile path' EQUALITY caseIgnoreMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{255} SINGLE-VALUE ) dn: cn=schema changetype: modify add: attributetypes -attributeTypes: ( 1.3.6.1.4.1.7165.2.1.26 NAME 'sambaAcctFlags' DESC 'Account Flags' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE ) +attributeTypes: ( 1.3.6.1.4.1.7165.2.1.36 NAME 'sambaUserWorkstations' DESC 'List of user workstations the user is allowed to logon to' EQUALITY caseIgnoreMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{255} SINGLE-VALUE ) dn: cn=schema changetype: modify add: attributetypes -attributeTypes: ( 1.3.6.1.4.1.7165.2.1.27 NAME 'sambaPwdLastSet' DESC 'Timestamp of the last password update' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE ) +attributeTypes: ( 1.3.6.1.4.1.7165.2.1.37 NAME 'sambaHomePath' DESC 'Home directory UNC path' EQUALITY caseIgnoreMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{128} ) dn: cn=schema changetype: modify add: attributetypes -attributeTypes: ( 1.3.6.1.4.1.7165.2.1.28 NAME 'sambaPwdCanChange' DESC 'Timestamp of when the user is allowed to update the password' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE ) +attributeTypes: ( 1.3.6.1.4.1.7165.2.1.38 NAME 'sambaDomainName' DESC 'Windows NT domain to which the user belongs' EQUALITY caseIgnoreMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{128} ) dn: cn=schema changetype: modify add: attributetypes -attributeTypes: ( 1.3.6.1.4.1.7165.2.1.29 NAME 'sambaPwdMustChange' DESC 'Timestamp of when the password will expire' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE ) +attributeTypes: ( 1.3.6.1.4.1.7165.2.1.47 NAME 'sambaMungedDial' DESC '' EQUALITY caseExactMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{1050} ) + +dn: cn=schema +changetype: modify +add: attributetypes +attributeTypes: ( 1.3.6.1.4.1.7165.2.1.54 NAME 'sambaPasswordHistory' DESC 'Concatenated MD4 hashes of the unicode passwords used on this account' EQUALITY caseIgnoreIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{32} ) + +## +## SID, of any type +## dn: cn=schema changetype: modify add: attributetypes -attributeTypes: ( 1.3.6.1.4.1.7165.2.1.30 NAME 'sambaLogonTime' DESC 'Timestamp of last logon' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE ) +attributeTypes: ( 1.3.6.1.4.1.7165.2.1.20 NAME 'sambaSID' DESC 'Security ID' EQUALITY caseIgnoreIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{64} SINGLE-VALUE ) + +## +## Primary group SID, compatible with ntSid +## dn: cn=schema changetype: modify add: attributetypes -attributeTypes: ( 1.3.6.1.4.1.7165.2.1.31 NAME 'sambaLogoffTime' DESC 'Timestamp of last logoff' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE ) +attributeTypes: ( 1.3.6.1.4.1.7165.2.1.23 NAME 'sambaPrimaryGroupSID' DESC 'Primary Group Security ID' EQUALITY caseIgnoreIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{64} SINGLE-VALUE ) dn: cn=schema changetype: modify add: attributetypes -attributeTypes: ( 1.3.6.1.4.1.7165.2.1.32 NAME 'sambaKickoffTime' DESC 'Timestamp of when the user will be logged off automatically' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE ) +attributeTypes: ( 1.3.6.1.4.1.7165.2.1.51 NAME 'sambaSIDList' DESC 'Security ID List' EQUALITY caseIgnoreIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{64} ) + +## +## group mapping attributes +## dn: cn=schema changetype: modify add: attributetypes -attributeTypes: ( 1.3.6.1.4.1.7165.2.1.33 NAME 'sambaHomeDrive' DESC 'Driver letter of home directory mapping' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE ) +attributeTypes: ( 1.3.6.1.4.1.7165.2.1.19 NAME 'sambaGroupType' DESC 'NT Group Type' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE ) + +## +## Store info on domain +## dn: cn=schema changetype: modify add: attributetypes -attributeTypes: ( 1.3.6.1.4.1.7165.2.1.34 NAME 'sambaLogonScript' DESC 'Logon script path' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE ) +attributeTypes: ( 1.3.6.1.4.1.7165.2.1.21 NAME 'sambaNextUserRid' DESC 'Next NT rid to give our for users' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE ) dn: cn=schema changetype: modify add: attributetypes -attributeTypes: ( 1.3.6.1.4.1.7165.2.1.35 NAME 'sambaProfilePath' DESC 'Roaming profile path' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE ) +attributeTypes: ( 1.3.6.1.4.1.7165.2.1.22 NAME 'sambaNextGroupRid' DESC 'Next NT rid to give out for groups' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE ) dn: cn=schema changetype: modify add: attributetypes -attributeTypes: ( 1.3.6.1.4.1.7165.2.1.36 NAME 'sambaUserWorkstations' DESC 'List of user workstations the user is allowed to logon to' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE ) +attributeTypes: ( 1.3.6.1.4.1.7165.2.1.39 NAME 'sambaNextRid' DESC 'Next NT rid to give out for anything' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE ) dn: cn=schema changetype: modify add: attributetypes -attributeTypes: ( 1.3.6.1.4.1.7165.2.1.37 NAME 'sambaHomePath' DESC 'Home directory UNC path' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 ) +attributeTypes: ( 1.3.6.1.4.1.7165.2.1.40 NAME 'sambaAlgorithmicRidBase' DESC 'Base at which the samba RID generation algorithm should operate' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE ) dn: cn=schema changetype: modify add: attributetypes -attributeTypes: ( 1.3.6.1.4.1.7165.2.1.38 NAME 'sambaDomainName' DESC 'Windows NT domain to which the user belongs' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 ) +attributeTypes: ( 1.3.6.1.4.1.7165.2.1.41 NAME 'sambaShareName' DESC 'Share Name' EQUALITY caseIgnoreMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE ) dn: cn=schema changetype: modify add: attributetypes -attributeTypes: ( 1.3.6.1.4.1.7165.2.1.20 NAME 'sambaSID' DESC 'Security ID' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE ) +attributeTypes: ( 1.3.6.1.4.1.7165.2.1.42 NAME 'sambaOptionName' DESC 'Option Name' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{256} ) dn: cn=schema changetype: modify add: attributetypes -attributeTypes: ( 1.3.6.1.4.1.7165.2.1.23 NAME 'sambaPrimaryGroupSID' DESC 'Primary Group Security ID' SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE ) +attributeTypes: ( 1.3.6.1.4.1.7165.2.1.43 NAME 'sambaBoolOption' DESC 'A boolean option' EQUALITY booleanMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE ) dn: cn=schema changetype: modify add: attributetypes -attributeTypes: ( 1.3.6.1.4.1.7165.2.1.19 NAME 'sambaGroupType' DESC 'NT Group Type' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE ) +attributeTypes: ( 1.3.6.1.4.1.7165.2.1.44 NAME 'sambaIntegerOption' DESC 'An integer option' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE ) dn: cn=schema changetype: modify add: attributetypes -attributeTypes: ( 1.3.6.1.4.1.7165.2.1.21 NAME 'sambaNextUserRid' DESC 'Next NT rid to give our for users' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE ) +attributeTypes: ( 1.3.6.1.4.1.7165.2.1.45 NAME 'sambaStringOption' DESC 'A string option' EQUALITY caseExactIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE ) dn: cn=schema changetype: modify add: attributetypes -attributeTypes: ( 1.3.6.1.4.1.7165.2.1.22 NAME 'sambaNextGroupRid' DESC 'Next NT rid to give out for groups' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE ) +attributeTypes: ( 1.3.6.1.4.1.7165.2.1.46 NAME 'sambaStringListOption' DESC 'A string list option' EQUALITY caseIgnoreMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 ) + +## +## unused +## +## dn: cn=schema +## changetype: modify +## add: attributetypes +## attributeTypes: ( 1.3.6.1.4.1.7165.2.1.50 NAME 'sambaPrivName' SUP name ) dn: cn=schema changetype: modify add: attributetypes -attributeTypes: ( 1.3.6.1.4.1.7165.2.1.39 NAME 'sambaNextRid' DESC 'Next NT rid to give out for anything' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE ) +attributeTypes: ( 1.3.6.1.4.1.7165.2.1.52 NAME 'sambaPrivilegeList' DESC 'Privileges List' EQUALITY caseIgnoreIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{64} ) dn: cn=schema changetype: modify add: attributetypes -attributeTypes: ( 1.3.6.1.4.1.7165.2.1.40 NAME 'sambaAlgorithmicRidBase' DESC 'Base at which the samba RID generation algorithm should operate' SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE ) +attributeTypes: ( 1.3.6.1.4.1.7165.2.1.53 NAME 'sambaTrustFlags' DESC 'Trust Password Flags' EQUALITY caseIgnoreIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ) ####################################################################### ## objectClasses used by Samba 3.0 schema ## ####################################################################### + +dn: cn=schema +changetype: modify +add: objectClasses +objectClasses: ( 1.3.6.1.4.1.7165.2.2.6 NAME 'sambaSamAccount' DESC 'Samba 3.0 Auxilary SAM Account' SUP top AUXILIARY MUST ( uid $ sambaSID ) MAY ( cn $ sambaLMPassword $ sambaNTPassword $ sambaPwdLastSet $ sambaLogonTime $ sambaLogoffTime $ sambaKickoffTime $ sambaPwdCanChange $ sambaPwdMustChange $ sambaAcctFlags $ displayName $ sambaHomePath $ sambaHomeDrive $ sambaLogonScript $ sambaProfilePath $ description $ sambaUserWorkstations $ sambaPrimaryGroupSID $ sambaDomainName $ sambaMungedDial $ sambaBadPasswordCount $ sambaBadPasswordTime $ sambaPasswordHistory $ sambaLogonHours)) + +## +## Group mapping info +## + +dn: cn=schema +changetype: modify +add: objectClasses +objectClasses: ( 1.3.6.1.4.1.7165.2.2.4 NAME 'sambaGroupMapping' DESC 'Samba Group Mapping' SUP top AUXILIARY MUST ( gidNumber $ sambaSID $ sambaGroupType ) MAY ( displayName $ description $ sambaSIDList)) + +## +## Trust password for trust relationships (any kind) +## + +dn: cn=schema +changetype: modify +add: objectClasses +objectClasses: ( 1.3.6.1.4.1.7165.2.2.14 NAME 'sambaTrustPassword' DESC 'Samba Trust Password' SUP top STRUCTURAL MUST ( sambaDomainName $ sambaNTPassword $ sambaTrustFlags ) MAY ( sambaSID $ sambaPwdLastSet )) + +## +## Whole-of-domain info +## + +dn: cn=schema +changetype: modify +add: objectClasses +objectClasses: ( 1.3.6.1.4.1.7165.2.2.5 NAME 'sambaDomain' DESC 'Samba Domain Information' SUP top STRUCTURAL MUST ( sambaDomainName $ sambaSID ) MAY ( sambaNextRid $ sambaNextGroupRid $ sambaNextUserRid $ sambaAlgorithmicRidBase )) + +## +## used for idmap_ldap module +## + +dn: cn=schema +changetype: modify +add: objectClasses +objectClasses: ( 1.3.6.1.4.1.7165.1.2.2.7 NAME 'sambaUnixIdPool' DESC 'Pool for allocating UNIX uids/gids' SUP top AUXILIARY MUST ( uidNumber $ gidNumber )) + dn: cn=schema changetype: modify add: objectClasses -objectClasses: ( 1.3.6.1.4.1.7165.2.2.6 NAME 'sambaSamAccount' DESC 'Samba 3.0 Auxilary SAM Account' SUP top AUXILIARY MUST ( uid $ sambaSID ) MAY ( cn $ sambaLMPassword $ sambaNTPassword $ sambaPwdLastSet $sambaLogonTime $ sambaLogoffTime $sambaKickoffTime $sambaPwdCanChange $ sambaPwdMustChange $ sambaAcctFlags $displayName $ sambaHomePath $ sambaHomeDrive $ sambaLogonScript $sambaProfilePath $ description $ sambaUserWorkstations $sambaPrimaryGroupSID $ sambaDomainName )) +objectClasses: ( 1.3.6.1.4.1.7165.1.2.2.8 NAME 'sambaIdmapEntry' DESC 'Mapping from a SID to an ID' SUP top AUXILIARY MUST ( sambaSID ) MAY ( uidNumber $ gidNumber )) dn: cn=schema changetype: modify add: objectClasses -objectClasses: ( 1.3.6.1.4.1.7165.2.2.4 NAME 'sambaGroupMapping' DESC 'Samba Group Mapping' SUP top AUXILIARY MUST ( gidNumber $ sambaSID $ sambaGroupType ) MAY ( displayName $ description )) +objectClasses: ( 1.3.6.1.4.1.7165.1.2.2.9 NAME 'sambaSidEntry' DESC 'Structural Class for a SID' SUP top STRUCTURAL MUST ( sambaSID )) dn: cn=schema changetype: modify add: objectClasses -objectClasses: ( 1.3.6.1.4.1.7165.2.2.5 NAME 'sambaDomain' DESC 'Samba Domain Information' SUP top STRUCTURAL MUST ( sambaDomainName $sambaSID ) MAY ( sambaNextRid $ sambaNextGroupRid $ sambaNextUserRid $sambaAlgorithmicRidBase ) ) +objectClasses: ( 1.3.6.1.4.1.7165.1.2.2.10 NAME 'sambaConfig' DESC 'Samba Configuration Section' SUP top AUXILIARY MAY ( description )) dn: cn=schema changetype: modify add: objectClasses -objectClasses: ( 1.3.6.1.4.1.7165.1.2.2.7 NAME 'sambaUnixIdPool' DESC 'Pool for allocating UNIX uids/gids' SUP top AUXILIARY MUST ( uidNumber $ gidNumber ) ) +objectClasses: ( 1.3.6.1.4.1.7165.2.2.11 NAME 'sambaShare' DESC 'Samba Share Section' SUP top STRUCTURAL MUST ( sambaShareName ) MAY ( description )) dn: cn=schema changetype: modify add: objectClasses -objectClasses: ( 1.3.6.1.4.1.7165.1.2.2.8 NAME 'sambaIdmapEntry' DESC 'Mapping from a SID to an ID' SUP top AUXILIARY MUST ( sambaSID ) MAY ( uidNumber $ gidNumber ) ) +objectClasses: ( 1.3.6.1.4.1.7165.2.2.12 NAME 'sambaConfigOption' DESC 'Samba Configuration Option' SUP top STRUCTURAL MUST ( sambaOptionName ) MAY ( sambaBoolOption $ sambaIntegerOption $ sambaStringOption $ sambaStringListoption $ description )) dn: cn=schema changetype: modify add: objectClasses -objectClasses: ( 1.3.6.1.4.1.7165.1.2.2.9 NAME 'sambaSidEntry' DESC 'Structural Class for a SID' SUP top STRUCTURAL MUST ( sambaSID ) ) +objectClasses: ( 1.3.6.1.4.1.7165.2.2.13 NAME 'sambaPrivilege' DESC 'Samba Privilege' SUP top AUXILIARY MUST ( sambaSID ) MAY ( sambaPrivilegeList )) diff --git a/packaging/Solaris/makepkg.sh.tmpl b/packaging/Solaris/makepkg.sh.tmpl index 2a46321f818..0d4dc02d1ce 100755 --- a/packaging/Solaris/makepkg.sh.tmpl +++ b/packaging/Solaris/makepkg.sh.tmpl @@ -49,6 +49,12 @@ add_dynamic_entries() echo s none /usr/lib/nss_winbind.so.2=/usr/lib/libnss_winbind.so 0755 root other fi + # add pam_winbind module to /usr/lib/security + if [ -f $DISTR_BASE/source/nsswitch/pam_winbind.so ] ; then + echo f none /usr/lib/security/pam_winbind.so.1=source/nsswitch/pam_winbind.so 0755 root bin + echo s none /usr/lib/security/pam_winbind.so=/usr/lib/security/pam_winbind.so.1 0777 root root + fi + # add the .dat codepages echo "#\n# Codepages \n#" for file in $DISTR_BASE/source/codepages/*.dat ; do diff --git a/packaging/Solaris/prototype.master b/packaging/Solaris/prototype.master index 6c5aa3e28ab..0863e158c3d 100644 --- a/packaging/Solaris/prototype.master +++ b/packaging/Solaris/prototype.master @@ -40,12 +40,12 @@ d none samba/docs 0755 root other d none samba/lib/charset 0755 root other f none samba/lib/smb.conf.example=examples/smb.conf.default 0644 root other d none samba/lib/regeditscripts 0755 root other -f none samba/lib/regeditscripts/NT4_PlainPassword.reg=docs/Registry/NT4_PlainPassword.reg 0444 root other -f none samba/lib/regeditscripts/Win95_PlainPassword.reg=docs/Registry/Win95_PlainPassword.reg 0444 root other -f none samba/lib/regeditscripts/Win98_PlainPassword.reg=docs/Registry/Win98_PlainPassword.reg 0444 root other -f none samba/lib/regeditscripts/WinME_PlainPassword.reg=docs/Registry/WinME_PlainPassword.reg 0444 root other -f none samba/lib/regeditscripts/Win2000_PlainPassword.reg=docs/Registry/Win2000_PlainPassword.reg 0444 root other -f none samba/lib/regeditscripts/WinXP_PlainPassword.reg=docs/Registry/WinXP_PlainPassword.reg 0444 root other +f none samba/lib/regeditscripts/NT4_PlainPassword.reg=docs/registry/NT4_PlainPassword.reg 0444 root other +f none samba/lib/regeditscripts/Win95_PlainPassword.reg=docs/registry/Win95_PlainPassword.reg 0444 root other +f none samba/lib/regeditscripts/Win98_PlainPassword.reg=docs/registry/Win98_PlainPassword.reg 0444 root other +f none samba/lib/regeditscripts/WinME_PlainPassword.reg=docs/registry/WinME_PlainPassword.reg 0444 root other +f none samba/lib/regeditscripts/Win2000_PlainPassword.reg=docs/registry/Win2000_PlainPassword.reg 0444 root other +f none samba/lib/regeditscripts/WinXP_PlainPassword.reg=docs/registry/WinXP_PlainPassword.reg 0444 root other # # Random files f none samba/docs/Samba-HOWTO-Collection.pdf=docs/Samba-HOWTO-Collection.pdf 0644 root other diff --git a/source/Makefile.in b/source/Makefile.in index b6fe22b5934..3a32bab1bab 100644 --- a/source/Makefile.in +++ b/source/Makefile.in @@ -1137,6 +1137,11 @@ bin/smbpasswd.@SHLIBEXT@: passdb/pdb_smbpasswd.@PICSUFFIX@ @$(SHLD) $(LDSHFLAGS) -o $@ passdb/pdb_smbpasswd.@PICSUFFIX@ \ @SONAMEFLAG@`basename $@` +bin/idmap_rid.@SHLIBEXT@: sam/idmap_rid.@PICSUFFIX@ + @echo "Building plugin $@" + @$(SHLD) $(LDSHFLAGS) -o $@ sam/idmap_rid.@PICSUFFIX@ \ + @SONAMEFLAG@`basename $@` + bin/weird.@SHLIBEXT@: $(DEVEL_HELP_WEIRD_OBJ:.o=.@PICSUFFIX@) @echo "Building plugin $@" @$(SHLD) $(LDSHFLAGS) -o $@ $(DEVEL_HELP_WEIRD_OBJ:.o=.@PICSUFFIX@) \ diff --git a/source/VERSION b/source/VERSION index f33e71fb577..0f2d88c66ff 100644 --- a/source/VERSION +++ b/source/VERSION @@ -29,7 +29,7 @@ SAMBA_VERSION_RELEASE=8 # e.g. SAMBA_VERSION_PRE_RELEASE=1 # # -> "2.2.9pre1" # ######################################################## -SAMBA_VERSION_PRE_RELEASE=1 +SAMBA_VERSION_PRE_RELEASE=2 ######################################################## # For 'rc' releases the version will be # @@ -51,7 +51,7 @@ SAMBA_VERSION_RC_RELEASE= # e.g. SAMBA_VERSION_IS_SVN_SNAPSHOT=yes # # -> "3.0.0-SVN-build-199" # ######################################################## -SAMBA_VERSION_IS_SVN_SNAPSHOT= +SAMBA_VERSION_IS_SVN_SNAPSHOT=yes ######################################################## # This can be set by vendors if they want... # diff --git a/source/aparser/parser.h b/source/aparser/parser.h index 319aeb5d138..24b0cd19305 100644 --- a/source/aparser/parser.h +++ b/source/aparser/parser.h @@ -4,7 +4,7 @@ #include <unistd.h> #include <sys/stat.h> #include <fcntl.h> -#include "../include/byteorder.h" +#include "include/byteorder.h" #define PARSE_SCALARS (1<<0) #define PARSE_BUFFERS (1<<1) diff --git a/source/auth/auth_util.c b/source/auth/auth_util.c index 5e8f18881fb..9be297818f5 100644 --- a/source/auth/auth_util.c +++ b/source/auth/auth_util.c @@ -930,18 +930,23 @@ static NTSTATUS fill_sam_account(TALLOC_CTX *mem_ctx, uid_t *uid, gid_t *gid, SAM_ACCOUNT **sam_account) { - fstring dom_user; + fstring dom_user, lower_username; fstring real_username; struct passwd *passwd; - fstr_sprintf(dom_user, "%s%s%s", domain, lp_winbind_separator(), - username); + fstrcpy( lower_username, username ); + strlower_m( lower_username ); + + fstr_sprintf(dom_user, "%s%c%s", domain, *lp_winbind_separator(), + lower_username); /* get the passwd struct but don't create the user if he/she does not exist. We were explicitly called from a following a winbindd authentication request so we should assume that nss_winbindd is working */ + map_username( dom_user ); + if ( !(passwd = smb_getpwnam( dom_user, real_username, True )) ) return NT_STATUS_NO_SUCH_USER; @@ -1104,18 +1109,25 @@ NTSTATUS make_server_info_info3(TALLOC_CTX *mem_ctx, } /* try to fill the SAM account.. If getpwnam() fails, then try the - add user script (2.2.x behavior) */ + add user script (2.2.x behavior). + + We use the _unmapped_ username here in an attempt to provide + consistent username mapping behavior between kerberos and NTLM[SSP] + authentication in domain mode security. I.E. Username mapping should + be applied to the fully qualified username (e.g. DOMAIN\user) and + no just the login name. Yes this mean swe called map_username() + unnecessarily in make_user_info_map() but that is how the current + code is designed. Making the change here is the least disruptive + place. -- jerry */ - nt_status = fill_sam_account(mem_ctx, nt_domain, internal_username, + nt_status = fill_sam_account(mem_ctx, nt_domain, sent_nt_username, &found_username, &uid, &gid, &sam_account); if (NT_STATUS_EQUAL(nt_status, NT_STATUS_NO_SUCH_USER)) { - DEBUG(3,("User %s does not exist, trying to add it\n", - internal_username)); - auth_add_user_script(nt_domain, internal_username); - nt_status = fill_sam_account(mem_ctx, nt_domain, - internal_username, &found_username, - &uid, &gid, &sam_account); + DEBUG(3,("User %s does not exist, trying to add it\n", internal_username)); + auth_add_user_script( nt_domain, sent_nt_username ); + nt_status = fill_sam_account( mem_ctx, nt_domain, sent_nt_username, + &found_username, &uid, &gid, &sam_account ); } if (!NT_STATUS_IS_OK(nt_status)) { diff --git a/source/auth/pampass.c b/source/auth/pampass.c index 3239686a20d..68871547b19 100644 --- a/source/auth/pampass.c +++ b/source/auth/pampass.c @@ -466,7 +466,7 @@ static BOOL smb_pam_start(pam_handle_t **pamh, const char *user, const char *rho if (rhost == NULL) { our_rhost = client_name(); - if (strequal(rhost,"UNKNOWN")) + if (strequal(our_rhost,"UNKNOWN")) our_rhost = client_addr(); } else { our_rhost = rhost; diff --git a/source/auth/pass_check.c b/source/auth/pass_check.c index 1ac8c1815a6..0425e01cdcb 100644 --- a/source/auth/pass_check.c +++ b/source/auth/pass_check.c @@ -599,7 +599,7 @@ NTSTATUS pass_check(const struct passwd *pass, const char *user, const char *pas NTSTATUS nt_status; -#if DEBUG_PASSWORD +#ifdef DEBUG_PASSWORD DEBUG(100, ("checking user=[%s] pass=[%s]\n", user, password)); #endif diff --git a/source/client/client.c b/source/client/client.c index e14bcaa2616..c2fec17d7ec 100644 --- a/source/client/client.c +++ b/source/client/client.c @@ -23,7 +23,7 @@ #define NO_SYSLOG #include "includes.h" -#include "../client/client_proto.h" +#include "client/client_proto.h" #ifndef REGISTER #define REGISTER 0 #endif @@ -1705,6 +1705,158 @@ static int cmd_chmod(void) return 0; } +static const char *filetype_to_str(mode_t mode) +{ + if (S_ISREG(mode)) { + return "regular file"; + } else if (S_ISDIR(mode)) { + return "directory"; + } else +#ifdef S_ISCHR + if (S_ISCHR(mode)) { + return "character device"; + } else +#endif +#ifdef S_ISBLK + if (S_ISBLK(mode)) { + return "block device"; + } else +#endif +#ifdef S_ISFIFO + if (S_ISFIFO(mode)) { + return "fifo"; + } else +#endif +#ifdef S_ISLNK + if (S_ISLNK(mode)) { + return "symbolic link"; + } else +#endif +#ifdef S_ISSOCK + if (S_ISSOCK(mode)) { + return "socket"; + } else +#endif + return ""; +} + +static char rwx_to_str(mode_t m, mode_t bt, char ret) +{ + if (m & bt) { + return ret; + } else { + return '-'; + } +} + +static char *unix_mode_to_str(char *s, mode_t m) +{ + char *p = s; + const char *str = filetype_to_str(m); + + switch(str[0]) { + case 'd': + *p++ = 'd'; + break; + case 'c': + *p++ = 'c'; + break; + case 'b': + *p++ = 'b'; + break; + case 'f': + *p++ = 'p'; + break; + case 's': + *p++ = str[1] == 'y' ? 'l' : 's'; + break; + case 'r': + default: + *p++ = '-'; + break; + } + *p++ = rwx_to_str(m, S_IRUSR, 'r'); + *p++ = rwx_to_str(m, S_IWUSR, 'w'); + *p++ = rwx_to_str(m, S_IXUSR, 'x'); + *p++ = rwx_to_str(m, S_IRGRP, 'r'); + *p++ = rwx_to_str(m, S_IWGRP, 'w'); + *p++ = rwx_to_str(m, S_IXGRP, 'x'); + *p++ = rwx_to_str(m, S_IROTH, 'r'); + *p++ = rwx_to_str(m, S_IWOTH, 'w'); + *p++ = rwx_to_str(m, S_IXOTH, 'x'); + *p++ = '\0'; + return s; +} + +/**************************************************************************** + UNIX stat. +****************************************************************************/ + +static int cmd_stat(void) +{ + pstring src, name; + fstring mode_str; + SMB_STRUCT_STAT sbuf; + + if (!SERVER_HAS_UNIX_CIFS(cli)) { + d_printf("Server doesn't support UNIX CIFS calls.\n"); + return 1; + } + + pstrcpy(src,cur_dir); + + if (!next_token_nr(NULL,name,NULL,sizeof(name))) { + d_printf("stat file\n"); + return 1; + } + + pstrcat(src,name); + + if (!cli_unix_stat(cli, src, &sbuf)) { + d_printf("%s stat file %s\n", + cli_errstr(cli), src); + return 1; + } + + /* Print out the stat values. */ + d_printf("File: %s\n", src); + d_printf("Size: %-12.0f\tBlocks: %u\t%s\n", + (double)sbuf.st_size, + (unsigned int)sbuf.st_blocks, + filetype_to_str(sbuf.st_mode)); + +#if defined(S_ISCHR) && defined(S_ISBLK) + if (S_ISCHR(sbuf.st_mode) || S_ISBLK(sbuf.st_mode)) { + d_printf("Inode: %.0f\tLinks: %u\tDevice type: %u,%u\n", + (double)sbuf.st_ino, + (unsigned int)sbuf.st_nlink, + unix_dev_major(sbuf.st_rdev), + unix_dev_minor(sbuf.st_rdev)); + } else +#endif + d_printf("Inode: %.0f\tLinks: %u\n", + (double)sbuf.st_ino, + (unsigned int)sbuf.st_nlink); + + d_printf("Access: (0%03o/%s)\tUid: %u\tGid: %u\n", + ((int)sbuf.st_mode & 0777), + unix_mode_to_str(mode_str, sbuf.st_mode), + (unsigned int)sbuf.st_uid, + (unsigned int)sbuf.st_gid); + + strftime(mode_str, sizeof(mode_str), "%F %T %z", localtime(&sbuf.st_atime)); + d_printf("Access: %s\n", mode_str); + + strftime(mode_str, sizeof(mode_str), "%F %T %z", localtime(&sbuf.st_mtime)); + d_printf("Modify: %s\n", mode_str); + + strftime(mode_str, sizeof(mode_str), "%F %T %z", localtime(&sbuf.st_ctime)); + d_printf("Change: %s\n", mode_str); + + return 0; +} + + /**************************************************************************** UNIX chown. ****************************************************************************/ @@ -2234,6 +2386,7 @@ static struct {"rm",cmd_del,"<mask> delete all matching files",{COMPL_REMOTE,COMPL_NONE}}, {"rmdir",cmd_rmdir,"<directory> remove a directory",{COMPL_NONE,COMPL_NONE}}, {"setmode",cmd_setmode,"filename <setmode string> change modes of file",{COMPL_REMOTE,COMPL_NONE}}, + {"stat",cmd_stat,"filename Do a UNIX extensions stat call on a file",{COMPL_REMOTE,COMPL_REMOTE}}, {"symlink",cmd_symlink,"<oldname> <newname> create a UNIX symlink",{COMPL_REMOTE,COMPL_REMOTE}}, {"tar",cmd_tar,"tar <c|x>[IXFqbgNan] current directory to/from <file name>",{COMPL_NONE,COMPL_NONE}}, {"tarmode",cmd_tarmode,"<full|inc|reset|noreset> tar's behaviour towards archive bits",{COMPL_NONE,COMPL_NONE}}, diff --git a/source/client/clitar.c b/source/client/clitar.c index 4cadef558d6..b4d6273f7bb 100644 --- a/source/client/clitar.c +++ b/source/client/clitar.c @@ -37,7 +37,7 @@ #include "includes.h" #include "clitar.h" -#include "../client/client_proto.h" +#include "client/client_proto.h" static int clipfind(char **aret, int ret, char *tok); diff --git a/source/client/mount.cifs.c b/source/client/mount.cifs.c index 55934e04b3c..1793a9ed7fe 100755 --- a/source/client/mount.cifs.c +++ b/source/client/mount.cifs.c @@ -38,7 +38,7 @@ #include <fcntl.h> #define MOUNT_CIFS_VERSION_MAJOR "1" -#define MOUNT_CIFS_VERSION_MINOR "4" +#define MOUNT_CIFS_VERSION_MINOR "5" #ifndef MOUNT_CIFS_VENDOR_SUFFIX #define MOUNT_CIFS_VENDOR_SUFFIX "" @@ -77,7 +77,13 @@ static void mount_cifs_usage(void) printf("\nMount the remote target, specified as a UNC name,"); printf(" to a local directory.\n\nOptions:\n"); printf("\tuser=<arg>\n\tpass=<arg>\n\tdom=<arg>\n"); - printf("\nOther less commonly used options are described in the manual page"); + printf("\nLess commonly used options:"); + printf("\n\tcredentials=<filename>,guest,perm,noperm,setuids,nosetuids,\n\trw,ro,sep=<char>,iocharset=<codepage>,suid,nosuid,exec,noexec"); + printf("\n\nOptions not needed for servers supporting CIFS Unix extensions (e.g. most Samba versions):"); + printf("\n\tuid=<uid>,gid=<gid>,dir_mode=<mode>,file_mode=<mode>"); + printf("\n\nRarely used options:"); + printf("\n\tport=<tcpport>,rsize=<size>,wsize=<size>,unc=<unc_name>,ip=<ip_address>,dev,nodev"); + printf("\n\nOptions are described in more detail in the manual page"); printf("\n\tman 8 mount.cifs\n"); printf("\nTo display the version number of the mount helper:"); printf("\n\t%s -V\n",thisprogram); @@ -246,9 +252,9 @@ static int get_password_from_file(int file_descript, char * filename) static int parse_options(char * options, int * filesys_flags) { char * data; - char * percent_char = 0; - char * value = 0; - char * next_keyword = 0; + char * percent_char = NULL; + char * value = NULL; + char * next_keyword = NULL; int rc = 0; if (!options) @@ -344,6 +350,8 @@ static int parse_options(char * options, int * filesys_flags) if (!value || !*value) { printf("target ip address argument missing"); } else if (strnlen(value, 35) < 35) { + if(verboseflag) + printf("ip address %s override specified\n",value); got_ip = 1; } else { printf("ip address too long\n"); @@ -459,6 +467,12 @@ static int parse_options(char * options, int * filesys_flags) *filesys_flags &= ~MS_NOEXEC; } else if (strncmp(data, "guest", 5) == 0) { got_password=1; + /* remove the parm since it would otherwise be logged by kern */ + data[0] = ','; + data[1] = ','; + data[2] = ','; + data[3] = ','; + data[4] = ','; } else if (strncmp(data, "ro", 2) == 0) { *filesys_flags |= MS_RDONLY; } else if (strncmp(data, "rw", 2) == 0) { @@ -497,7 +511,7 @@ static int parse_options(char * options, int * filesys_flags) if(next_keyword) *next_keyword = ','; else - data = 0; + data = NULL; } return 0; } @@ -515,7 +529,7 @@ char * parse_server(char ** punc_name) if(length > 1023) { printf("mount error: UNC name too long"); - return 0; + return NULL; } if (strncasecmp("cifs://",unc_name,7) == 0) return parse_cifs_url(unc_name+7); @@ -526,7 +540,7 @@ char * parse_server(char ** punc_name) if(length < 3) { /* BB add code to find DFS root here */ printf("\nMounting the DFS root for domain not implemented yet"); - return 0; + return NULL; } else { if(strncmp(unc_name,"//",2) && strncmp(unc_name,"\\\\",2)) { /* check for nfs syntax ie server:share */ @@ -542,7 +556,7 @@ char * parse_server(char ** punc_name) } else { printf("mount error: improperly formatted UNC name."); printf(" %s does not begin with \\\\ or //\n",unc_name); - return 0; + return NULL; } } else { continue_unc_parsing: @@ -553,15 +567,20 @@ continue_unc_parsing: (share = strchr(unc_name,'\\'))) { *share = 0; /* temporarily terminate the string */ share += 1; - host_entry = gethostbyname(unc_name); + if(got_ip == 0) { + host_entry = gethostbyname(unc_name); + } *(share - 1) = '/'; /* put the slash back */ -/* rc = getipnodebyname(unc_name, AF_INET, AT_ADDRCONFIG ,&rc);*/ + if(got_ip) { + if(verboseflag) + printf("ip address specified explicitly\n"); + return NULL; + } if(host_entry == NULL) { printf("mount error: could not find target server. TCP name %s not found ", unc_name); printf(" rc = %d\n",rc); - return 0; - } - else { + return NULL; + } else { /* BB should we pass an alternate version of the share name as Unicode */ /* BB what about ipv6? BB */ /* BB add retries with alternate servers in list */ @@ -571,46 +590,46 @@ continue_unc_parsing: ipaddress_string = inet_ntoa(server_ipaddr); if(ipaddress_string == NULL) { printf("mount error: could not get valid ip address for target server\n"); - return 0; + return NULL; } return ipaddress_string; } } else { /* BB add code to find DFS root (send null path on get DFS Referral to specified server here */ printf("Mounting the DFS root for a particular server not implemented yet\n"); - return 0; + return NULL; } } } } static struct option longopts[] = { - { "all", 0, 0, 'a' }, - { "help",0, 0, 'h' }, - { "move",0, 0, 'm' }, - { "bind",0, 0, 'b' }, - { "read-only", 0, 0, 'r' }, - { "ro", 0, 0, 'r' }, - { "verbose", 0, 0, 'v' }, - { "version", 0, 0, 'V' }, - { "read-write", 0, 0, 'w' }, - { "rw", 0, 0, 'w' }, - { "options", 1, 0, 'o' }, - { "type", 1, 0, 't' }, - { "rsize",1, 0, 'R' }, - { "wsize",1, 0, 'W' }, - { "uid", 1, 0, '1'}, - { "gid", 1, 0, '2'}, - { "user",1,0,'u'}, - { "username",1,0,'u'}, - { "dom",1,0,'d'}, - { "domain",1,0,'d'}, - { "password",1,0,'p'}, - { "pass",1,0,'p'}, - { "credentials",1,0,'c'}, - { "port",1,0,'P'}, - /* { "uuid",1,0,'U'}, */ /* BB unimplemented */ - { NULL, 0, 0, 0 } + { "all", 0, NULL, 'a' }, + { "help",0, NULL, 'h' }, + { "move",0, NULL, 'm' }, + { "bind",0, NULL, 'b' }, + { "read-only", 0, NULL, 'r' }, + { "ro", 0, NULL, 'r' }, + { "verbose", 0, NULL, 'v' }, + { "version", 0, NULL, 'V' }, + { "read-write", 0, NULL, 'w' }, + { "rw", 0, NULL, 'w' }, + { "options", 1, NULL, 'o' }, + { "type", 1, NULL, 't' }, + { "rsize",1, NULL, 'R' }, + { "wsize",1, NULL, 'W' }, + { "uid", 1, NULL, '1'}, + { "gid", 1, NULL, '2'}, + { "user",1,NULL,'u'}, + { "username",1,NULL,'u'}, + { "dom",1,NULL,'d'}, + { "domain",1,NULL,'d'}, + { "password",1,NULL,'p'}, + { "pass",1,NULL,'p'}, + { "credentials",1,NULL,'c'}, + { "port",1,NULL,'P'}, + /* { "uuid",1,NULL,'U'}, */ /* BB unimplemented */ + { NULL, 0, NULL, 0 } }; int main(int argc, char ** argv) @@ -767,12 +786,15 @@ int main(int argc, char ** argv) get_password_from_file(0, getenv("PASSWD_FILE")); } + if (orgoptions && parse_options(orgoptions, &flags)) + return -1; + ipaddr = parse_server(&share_name); - if(ipaddr == NULL) + if((ipaddr == NULL) && (got_ip == 0)) { + printf("No ip address specified and hostname not found\n"); return -1; + } - if (orgoptions && parse_options(orgoptions, &flags)) - return -1; /* BB save off path and pop after mount returns? */ resolved_path = malloc(PATH_MAX+1); diff --git a/source/configure.in b/source/configure.in index 69152d8fc8f..df787655590 100644 --- a/source/configure.in +++ b/source/configure.in @@ -288,6 +288,21 @@ dnl Check if we use GNU ld LD=ld AC_PROG_LD_GNU +dnl Certain versions of GNU ld the default is not to have the +dnl --allow-shlib-undefined flag defined. This causes a stackload of +dnl warnings when building modules. +if test "$ac_cv_prog_gnu_ld" = "yes"; then + ac_cv_gnu_ld_version=`$LD -v 2>/dev/null | head -1` + AC_MSG_CHECKING(GNU ld release date) + changequote(,)dnl + ac_cv_gnu_ld_date=`echo $ac_cv_gnu_ld_version | sed -n 's,^.*\([2-9][0-9][0-9][0-9]\)[-]*\([01][0-9]\)[-]*\([0-3][0-9]\).*$,\1\2\3,p'` + changequote([,])dnl + AC_MSG_RESULT(${ac_cv_gnu_ld_date}) + if test "$ac_cv_gnu_ld_date" -lt 20030217; then + ac_cv_gnu_ld_no_default_allow_shlib_undefined=yes + fi +fi + dnl needed before AC_TRY_COMPILE AC_ISC_POSIX @@ -456,17 +471,20 @@ case "$host_os" in rm -fr conftest.c case "$ac_cv_gcc_compiler_version_number" in *"gcc version 2.6"*|*"gcc version 2.7"*) - CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE" + CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE -D_REENTRANT" + LDFLAGS="$LDFLAGS -lthread" AC_DEFINE(_LARGEFILE64_SOURCE, 1, [Whether to enable large file support]) ;; *) - CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" + CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE -D_REENTRANT -D_FILE_OFFSET_BITS=64" + LDFLAGS="$LDFLAGS -lthread" AC_DEFINE(_LARGEFILE64_SOURCE, 1, [Whether to enable large file support]) AC_DEFINE(_FILE_OFFSET_BITS, 64, [File offset bits]) ;; esac else - CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" + CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE -D_REENTRANT -D_FILE_OFFSET_BITS=64" + LDFLAGS="$LDFLAGS -lthread" AC_DEFINE(_LARGEFILE64_SOURCE, 1, [Whether to enable large file support]) AC_DEFINE(_FILE_OFFSET_BITS, 64, [File offset bits]) fi @@ -958,7 +976,7 @@ if test x"$ac_cv_func_execl" = x"no"; then fi AC_CHECK_FUNCS(dlopen dlclose dlsym dlerror waitpid getcwd strdup strndup strnlen strtoul strerror chown fchown chmod fchmod chroot link mknod mknod64) -AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync bzero memset strlcpy strlcat setpgid) +AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync memset strlcpy strlcat setpgid) AC_CHECK_FUNCS(memmove vsnprintf snprintf asprintf vasprintf setsid glob strpbrk pipe crypt16 getauthuid) AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction sigset innetgr setnetgrent getnetgrent endnetgrent) AC_CHECK_FUNCS(initgroups select poll rdchk getgrnam getgrent pathconf realpath) @@ -1129,7 +1147,11 @@ if test "$enable_shared" = "yes"; then case "$host_os" in *linux*) AC_DEFINE(LINUX,1,[Whether the host os is linux]) BLDSHARED="true" - LDSHFLAGS="-shared -Wl,-Bsymbolic" + if test "${ac_cv_gnu_ld_no_default_allow_shlib_undefined}" = "yes"; then + LDSHFLAGS="-shared -Wl,-Bsymbolic -Wl,--allow-shlib-undefined" + else + LDSHFLAGS="-shared -Wl,-Bsymbolic" + fi DYNEXP="-Wl,--export-dynamic" PICFLAGS="-fPIC" SONAMEFLAG="-Wl,-soname=" @@ -4291,6 +4313,14 @@ AC_CHECK_MEMBER(struct passwd.pw_age, AC_DEFINE(HAVE_PASSWD_PW_AGE, 1, [Defined if struct passwd has pw_age field]),, [#include <pwd.h>]) +# AIX 4.3.x and 5.1 do not have as many members in +# struct secmethod_table as AIX 5.2 +AC_CHECK_MEMBERS([struct secmethod_table.method_attrlist], , , + [#include <usersec.h>]) +AC_CHECK_MEMBERS([struct secmethod_table.method_version], , , + [#include <usersec.h>]) + + ################################################# # Check to see if we should use the included popt @@ -4427,6 +4457,7 @@ SMB_SUBSYSTEM(RPC,smbd/server.o) SMB_MODULE(idmap_ldap, sam/idmap_ldap.o, "bin/idmap_ldap.$SHLIBEXT", IDMAP) SMB_MODULE(idmap_tdb, sam/idmap_tdb.o, "bin/idmap_tdb.$SHLIBEXT", IDMAP) +SMB_MODULE(idmap_rid, sam/idmap_rid.o, "bin/idmap_rid.$SHLIBEXT", IDMAP) SMB_SUBSYSTEM(IDMAP,sam/idmap.o) SMB_MODULE(charset_weird, modules/weird.o, "bin/weird.$SHLIBEXT", CHARSET) diff --git a/source/groupdb/mapping.c b/source/groupdb/mapping.c index 548651dfd53..d189f447d08 100644 --- a/source/groupdb/mapping.c +++ b/source/groupdb/mapping.c @@ -945,153 +945,18 @@ BOOL get_group_from_gid(gid_t gid, GROUP_MAP *map) if ( (grp=getgrgid(gid)) == NULL) return False; - /* - * make a group map from scratch if doesn't exist. - */ - become_root(); ret = pdb_getgrgid(map, gid); unbecome_root(); if ( !ret ) { - map->gid=gid; - map->sid_name_use=SID_NAME_ALIAS; - - /* interim solution until we have a last RID allocated */ - - sid_copy(&map->sid, get_global_sam_sid()); - sid_append_rid(&map->sid, pdb_gid_to_group_rid(gid)); - - fstrcpy(map->nt_name, grp->gr_name); - fstrcpy(map->comment, "Local Unix Group"); + return False; } return True; } - - -/**************************************************************************** - Get the member users of a group and - all the users who have that group as primary. - - give back an array of SIDS - return the grand number of users - - - TODO: sort the list and remove duplicate. JFM. - -****************************************************************************/ - -BOOL get_sid_list_of_group(gid_t gid, DOM_SID **sids, int *num_sids) -{ - struct group *grp; - int i=0; - char *gr; - DOM_SID *s; - - struct sys_pwent *userlist; - struct sys_pwent *user; - - if(!init_group_mapping()) { - DEBUG(0,("failed to initialize group mapping\n")); - return(False); - } - - *num_sids = 0; - *sids=NULL; - - if ( (grp=getgrgid(gid)) == NULL) - return False; - - gr = grp->gr_mem[0]; - DEBUG(10, ("getting members\n")); - - while (gr && (*gr != (char)'\0')) { - SAM_ACCOUNT *group_member_acct = NULL; - BOOL found_user; - s = Realloc((*sids), sizeof(**sids)*(*num_sids+1)); - if (!s) { - DEBUG(0,("get_uid_list_of_group: unable to enlarge SID list!\n")); - return False; - } - else (*sids) = s; - - if (!NT_STATUS_IS_OK(pdb_init_sam(&group_member_acct))) { - continue; - } - - become_root(); - found_user = pdb_getsampwnam(group_member_acct, gr); - unbecome_root(); - - if (found_user) { - sid_copy(&(*sids)[*num_sids], pdb_get_user_sid(group_member_acct)); - (*num_sids)++; - } - - pdb_free_sam(&group_member_acct); - - gr = grp->gr_mem[++i]; - } - DEBUG(10, ("got [%d] members\n", *num_sids)); - - winbind_off(); - - user = userlist = getpwent_list(); - - while (user != NULL) { - - SAM_ACCOUNT *group_member_acct = NULL; - BOOL found_user; - - if (user->pw_gid != gid) { - user = user->next; - continue; - } - - s = Realloc((*sids), sizeof(**sids)*(*num_sids+1)); - if (!s) { - DEBUG(0,("get_sid_list_of_group: unable to enlarge " - "SID list!\n")); - pwent_free(userlist); - winbind_on(); - return False; - } - else (*sids) = s; - - if (!NT_STATUS_IS_OK(pdb_init_sam(&group_member_acct))) { - continue; - } - - become_root(); - found_user = pdb_getsampwnam(group_member_acct, user->pw_name); - unbecome_root(); - - if (found_user) { - sid_copy(&(*sids)[*num_sids], - pdb_get_user_sid(group_member_acct)); - (*num_sids)++; - } else { - DEBUG(4,("get_sid_list_of_group: User %s [uid == %lu] " - "has no samba account\n", - user->pw_name, (unsigned long)user->pw_uid)); - if (algorithmic_uid_to_sid(&(*sids)[*num_sids], - user->pw_uid)) - (*num_sids)++; - } - pdb_free_sam(&group_member_acct); - - user = user->next; - } - pwent_free(userlist); - DEBUG(10, ("got primary groups, members: [%d]\n", *num_sids)); - - winbind_on(); - return True; -} - /**************************************************************************** Create a UNIX group on demand. ****************************************************************************/ diff --git a/source/include/ads.h b/source/include/ads.h index 4daa65e796d..de020f2a3f4 100644 --- a/source/include/ads.h +++ b/source/include/ads.h @@ -224,3 +224,6 @@ typedef void **ADS_MODLIST; #ifndef HAVE_AP_OPTS_USE_SUBKEY #define AP_OPTS_USE_SUBKEY 0 #endif + +#define WELL_KNOWN_GUID_COMPUTERS "AA312825768811D1ADED00C04FD8D5CD" +#define WELL_KNOWN_GUID_USERS "A9D1CA15768811D1ADED00C04FD8D5CD" diff --git a/source/include/doserr.h b/source/include/doserr.h index 576aeda2bf7..c6d6b1fac90 100644 --- a/source/include/doserr.h +++ b/source/include/doserr.h @@ -183,6 +183,7 @@ #define WERR_NO_MORE_ITEMS W_ERROR(259) #define WERR_MORE_DATA W_ERROR(234) #define WERR_INVALID_OWNER W_ERROR(1307) +#define WERR_IO_PENDING W_ERROR(997) #define WERR_CAN_NOT_COMPLETE W_ERROR(1003) #define WERR_INVALID_SECURITY_DESCRIPTOR W_ERROR(1338) #define WERR_SERVER_UNAVAILABLE W_ERROR(1722) diff --git a/source/include/includes.h b/source/include/includes.h index 3ea4eaa35a9..d51e4c53f1a 100644 --- a/source/include/includes.h +++ b/source/include/includes.h @@ -793,9 +793,9 @@ extern int errno; #include "ubi_sLinkList.h" #include "ubi_dLinkList.h" #include "dlinklist.h" -#include "../tdb/tdb.h" -#include "../tdb/spinlock.h" -#include "../tdb/tdbutil.h" +#include "tdb/tdb.h" +#include "tdb/spinlock.h" +#include "tdb/tdbutil.h" #include "talloc.h" #include "nt_status.h" #include "ads.h" diff --git a/source/include/libsmb_internal.h b/source/include/libsmb_internal.h index 21fe47d4b29..9111f36eaf7 100644 --- a/source/include/libsmb_internal.h +++ b/source/include/libsmb_internal.h @@ -6,7 +6,7 @@ #define SMBC_DIR_MODE (S_IFDIR | 0555) -#include "../include/libsmbclient.h" +#include "include/libsmbclient.h" struct _SMBCSRV { diff --git a/source/include/nt_printing.h b/source/include/nt_printing.h index 762b1c69170..ee29636c88d 100644 --- a/source/include/nt_printing.h +++ b/source/include/nt_printing.h @@ -450,10 +450,8 @@ typedef struct _Printer{ uint32 jobid; /* jobid in printing backend */ BOOL printer_type; TALLOC_CTX *ctx; - union { - fstring handlename; - fstring printerservername; - } dev; + fstring servername; + fstring sharename; uint32 type; uint32 access_granted; struct { diff --git a/source/include/printing.h b/source/include/printing.h index bf7c61b251e..fd1e7e43e4e 100644 --- a/source/include/printing.h +++ b/source/include/printing.h @@ -47,7 +47,13 @@ struct printjob { /* Information for print interfaces */ struct printif { - int (*queue_get)(int snum, print_queue_struct **q, + /* value of the 'printing' option for this service */ + enum printing_types type; + + int (*queue_get)(const char *printer_name, + enum printing_types printing_type, + char *lpq_command, + print_queue_struct **q, print_status_struct *status); int (*queue_pause)(int snum); int (*queue_resume)(int snum); diff --git a/source/include/rpc_spoolss.h b/source/include/rpc_spoolss.h index f2b78f91bc0..7c5942759f4 100755 --- a/source/include/rpc_spoolss.h +++ b/source/include/rpc_spoolss.h @@ -206,6 +206,7 @@ #define PRINTER_NOTIFY_TYPE 0x00 #define JOB_NOTIFY_TYPE 0x01 +#define PRINT_TABLE_END 0xFF #define MAX_PRINTER_NOTIFY 26 #define MAX_JOB_NOTIFY 24 diff --git a/source/include/smb.h b/source/include/smb.h index 7317fd16b0f..bc99a2a6fdd 100644 --- a/source/include/smb.h +++ b/source/include/smb.h @@ -380,8 +380,7 @@ typedef struct #include "fake_file.h" -typedef struct files_struct -{ +typedef struct files_struct { struct files_struct *next, *prev; int fnum; struct connection_struct *conn; diff --git a/source/lib/charcnv.c b/source/lib/charcnv.c index 40004826b4a..0fe1f15ed5d 100644 --- a/source/lib/charcnv.c +++ b/source/lib/charcnv.c @@ -394,6 +394,13 @@ size_t convert_string(charset_t from, charset_t to, #endif } } + if (!dlen) { + /* Even if we fast path we should note if we ran out of room. */ + if (((slen != (size_t)-1) && slen) || + ((slen == (size_t)-1) && lastp)) { + errno = E2BIG; + } + } return retval; } else if (from == CH_UCS2 && to != CH_UCS2) { const unsigned char *p = (const unsigned char *)src; @@ -423,6 +430,13 @@ size_t convert_string(charset_t from, charset_t to, #endif } } + if (!dlen) { + /* Even if we fast path we should note if we ran out of room. */ + if (((slen != (size_t)-1) && slen) || + ((slen == (size_t)-1) && lastp)) { + errno = E2BIG; + } + } return retval; } else if (from != CH_UCS2 && to == CH_UCS2) { const unsigned char *p = (const unsigned char *)src; @@ -452,6 +466,13 @@ size_t convert_string(charset_t from, charset_t to, #endif } } + if (!dlen) { + /* Even if we fast path we should note if we ran out of room. */ + if (((slen != (size_t)-1) && slen) || + ((slen == (size_t)-1) && lastp)) { + errno = E2BIG; + } + } return retval; } diff --git a/source/lib/ms_fnmatch.c b/source/lib/ms_fnmatch.c index 42c91bd18df..3040dc7f9d3 100644 --- a/source/lib/ms_fnmatch.c +++ b/source/lib/ms_fnmatch.c @@ -1,7 +1,7 @@ /* Unix SMB/CIFS implementation. filename matching routine - Copyright (C) Andrew Tridgell 1992-1998 + Copyright (C) Andrew Tridgell 1992-2004 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,238 +15,204 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ /* This module was originally based on fnmatch.c copyright by the Free - Software Foundation. It bears little resemblence to that code now + Software Foundation. It bears little (if any) resemblence to that + code now */ -#if FNMATCH_TEST -#include <stdio.h> -#include <stdlib.h> -#else #include "includes.h" -#endif -/* - bugger. we need a separate wildcard routine for older versions - of the protocol. This is not yet perfect, but its a lot - better than what we had */ -static int ms_fnmatch_lanman_core(const smb_ucs2_t *pattern, - const smb_ucs2_t *string, - BOOL case_sensitive) +static int null_match(const smb_ucs2_t *p) { - const smb_ucs2_t *p = pattern, *n = string; - smb_ucs2_t c; + for (;*p;p++) { + if (*p != UCS2_CHAR('*') && + *p != UCS2_CHAR('<') && + *p != UCS2_CHAR('"') && + *p != UCS2_CHAR('>')) return -1; + } + return 0; +} - if (strcmp_wa(p, "?")==0 && strcmp_wa(n, ".")) goto match; +/* + the max_n structure is purely for efficiency, it doesn't contribute + to the matching algorithm except by ensuring that the algorithm does + not grow exponentially +*/ +struct max_n { + const smb_ucs2_t *predot; + const smb_ucs2_t *postdot; +}; + + +/* + p and n are the pattern and string being matched. The max_n array is + an optimisation only. The ldot pointer is NULL if the string does + not contain a '.', otherwise it points at the last dot in 'n'. +*/ +static int ms_fnmatch_core(const smb_ucs2_t *p, const smb_ucs2_t *n, + struct max_n *max_n, const smb_ucs2_t *ldot, + BOOL is_case_sensitive) +{ + smb_ucs2_t c; + int i; while ((c = *p++)) { switch (c) { - case UCS2_CHAR('.'): - if (! *n) goto next; - if (*n != UCS2_CHAR('.')) goto nomatch; - n++; - break; + /* a '*' matches zero or more characters of any type */ + case UCS2_CHAR('*'): + if (max_n->predot && max_n->predot <= n) { + return null_match(p); + } + for (i=0; n[i]; i++) { + if (ms_fnmatch_core(p, n+i, max_n+1, ldot, is_case_sensitive) == 0) { + return 0; + } + } + if (!max_n->predot || max_n->predot > n) max_n->predot = n; + return null_match(p); + /* a '<' matches zero or more characters of + any type, but stops matching at the last + '.' in the string. */ + case UCS2_CHAR('<'): + if (max_n->predot && max_n->predot <= n) { + return null_match(p); + } + if (max_n->postdot && max_n->postdot <= n && n <= ldot) { + return -1; + } + for (i=0; n[i]; i++) { + if (ms_fnmatch_core(p, n+i, max_n+1, ldot, is_case_sensitive) == 0) return 0; + if (n+i == ldot) { + if (ms_fnmatch_core(p, n+i+1, max_n+1, ldot, is_case_sensitive) == 0) return 0; + if (!max_n->postdot || max_n->postdot > n) max_n->postdot = n; + return -1; + } + } + if (!max_n->predot || max_n->predot > n) max_n->predot = n; + return null_match(p); + + /* a '?' matches any single character */ case UCS2_CHAR('?'): - if (! *n) goto next; - if ((*n == UCS2_CHAR('.') && - n[1] != UCS2_CHAR('.')) || ! *n) - goto next; + if (! *n) { + return -1; + } n++; break; + /* a '?' matches any single character */ case UCS2_CHAR('>'): - if (! *n) goto next; if (n[0] == UCS2_CHAR('.')) { - if (! n[1] && ms_fnmatch_lanman_core(p, n+1, case_sensitive) == 0) goto match; - if (ms_fnmatch_lanman_core(p, n, case_sensitive) == 0) goto match; - goto nomatch; - } - n++; - break; - - case UCS2_CHAR('*'): - if (! *n) goto next; - if (! *p) goto match; - for (; *n; n++) { - if (ms_fnmatch_lanman_core(p, n, case_sensitive) == 0) goto match; - } - break; - - case UCS2_CHAR('<'): - for (; *n; n++) { - if (ms_fnmatch_lanman_core(p, n, case_sensitive) == 0) goto match; - if (*n == UCS2_CHAR('.') && - !strchr_w(n+1,UCS2_CHAR('.'))) { - n++; - break; + if (! n[1] && null_match(p) == 0) { + return 0; } + break; } + if (! *n) return null_match(p); + n++; break; case UCS2_CHAR('"'): - if (*n == 0 && ms_fnmatch_lanman_core(p, n, case_sensitive) == 0) goto match; - if (*n != UCS2_CHAR('.')) goto nomatch; + if (*n == 0 && null_match(p) == 0) { + return 0; + } + if (*n != UCS2_CHAR('.')) return -1; n++; break; default: - if (case_sensitive) { - if (c != *n) goto nomatch; - } else { - if (tolower_w(c) != tolower_w(*n)) goto nomatch; + if (c != *n) { + if (is_case_sensitive) { + return -1; + } + if (toupper_w(c) != toupper_w(*n)) { + return -1; + } } n++; + break; } } - if (! *n) goto match; + if (! *n) { + return 0; + } - nomatch: - /* - if (verbose) printf("NOMATCH pattern=[%s] string=[%s]\n", pattern, string); - */ return -1; - -next: - if (ms_fnmatch_lanman_core(p, n, case_sensitive) == 0) goto match; - goto nomatch; - - match: - /* - if (verbose) printf("MATCH pattern=[%s] string=[%s]\n", pattern, string); - */ - return 0; } -static int ms_fnmatch_lanman1(const smb_ucs2_t *pattern, - const smb_ucs2_t *string, BOOL case_sensitive) +int ms_fnmatch(const char *pattern, const char *string, enum protocol_types protocol, + BOOL is_case_sensitive) { - if (!strpbrk_wa(pattern, "?*<>\"")) { - smb_ucs2_t s[] = {UCS2_CHAR('.'), 0}; - if (strcmp_wa(string,"..") == 0) string = s; - return strcasecmp_w(pattern, string); - } + wpstring p, s; + int ret, count, i; + struct max_n *max_n = NULL; - if (strcmp_wa(string,"..") == 0 || strcmp_wa(string,".") == 0) { - smb_ucs2_t dot[] = {UCS2_CHAR('.'), 0}; - smb_ucs2_t dotdot[] = {UCS2_CHAR('.'), UCS2_CHAR('.'), 0}; - return ms_fnmatch_lanman_core(pattern, dotdot, case_sensitive) && - ms_fnmatch_lanman_core(pattern, dot, case_sensitive); + if (strcmp(string, "..") == 0) { + string = "."; } - return ms_fnmatch_lanman_core(pattern, string, case_sensitive); -} - - -/* the following function was derived using the masktest utility - - after years of effort we finally have a perfect MS wildcard - matching routine! - - NOTE: this matches only filenames with no directory component - - Returns 0 on match, -1 on fail. -*/ -static int ms_fnmatch_w(const smb_ucs2_t *pattern, const smb_ucs2_t *string, - int protocol, BOOL case_sensitive) -{ - const smb_ucs2_t *p = pattern, *n = string; - smb_ucs2_t c; - - if (protocol <= PROTOCOL_LANMAN2) { - return ms_fnmatch_lanman1(pattern, string, case_sensitive); + if (strpbrk(pattern, "<>*?\"") == NULL) { + /* this is not just an optmisation - it is essential + for LANMAN1 correctness */ + if (is_case_sensitive) { + return strcmp(pattern, string); + } else { + return StrCaseCmp(pattern, string); + } } - while ((c = *p++)) { - switch (c) { - case UCS2_CHAR('?'): - if (! *n) return -1; - n++; - break; - - case UCS2_CHAR('>'): - if (n[0] == UCS2_CHAR('.')) { - if (! n[1] && ms_fnmatch_w(p, n+1, protocol, case_sensitive) == 0) return 0; - if (ms_fnmatch_w(p, n, protocol, case_sensitive) == 0) return 0; - return -1; - } - if (! *n) return ms_fnmatch_w(p, n, protocol, case_sensitive); - n++; - break; - - case UCS2_CHAR('*'): - while (*p == UCS2_CHAR('*')) { - p++; - } - for (; *n; n++) { - if (ms_fnmatch_w(p, n, protocol, case_sensitive) == 0) return 0; - } - break; - - case UCS2_CHAR('<'): - for (; *n; n++) { - if (ms_fnmatch_w(p, n, protocol, case_sensitive) == 0) return 0; - if (*n == UCS2_CHAR('.') && !strchr_wa(n+1,'.')) { - n++; - break; - } - } - break; + pstrcpy_wa(p, pattern); + pstrcpy_wa(s, string); - case UCS2_CHAR('"'): - if (*n == 0 && ms_fnmatch_w(p, n, protocol, case_sensitive) == 0) return 0; - if (*n != UCS2_CHAR('.')) return -1; - n++; - break; - - default: - if (case_sensitive) { - if (c != *n) return -1; - } else { - if (tolower_w(c) != tolower_w(*n)) return -1; + if (protocol <= PROTOCOL_LANMAN2) { + /* + for older negotiated protocols it is possible to + translate the pattern to produce a "new style" + pattern that exactly matches w2k behaviour + */ + for (i=0;p[i];i++) { + if (p[i] == UCS2_CHAR('?')) { + p[i] = UCS2_CHAR('>'); + } else if (p[i] == UCS2_CHAR('.') && + (p[i+1] == UCS2_CHAR('?') || + p[i+1] == UCS2_CHAR('*') || + p[i+1] == 0)) { + p[i] = UCS2_CHAR('"'); + } else if (p[i] == UCS2_CHAR('*') && p[i+1] == UCS2_CHAR('.')) { + p[i] = UCS2_CHAR('<'); } - n++; } } - - if (! *n) return 0; - - return -1; -} -int ms_fnmatch(const char *pattern, const char *string, int protocol, - BOOL case_senstive) -{ - wpstring buffer_pattern, buffer_string; - int ret; - size_t size; - - size = push_ucs2(NULL, buffer_pattern, pattern, sizeof(buffer_pattern), STR_TERMINATE); - if (size == (size_t)-1) { - return -1; - /* Not quite the right answer, but finding the right one - under this failure case is expensive, and it's pretty close */ + for (count=i=0;p[i];i++) { + if (p[i] == UCS2_CHAR('*') || p[i] == UCS2_CHAR('<')) count++; } - - size = push_ucs2(NULL, buffer_string, string, sizeof(buffer_string), STR_TERMINATE); - if (size == (size_t)-1) { - return -1; - /* Not quite the right answer, but finding the right one - under this failure case is expensive, and it's pretty close */ + + if (count != 0) { + max_n = calloc(sizeof(struct max_n), count); + if (!max_n) { + return -1; + } } - ret = ms_fnmatch_w(buffer_pattern, buffer_string, protocol, case_senstive); - DEBUG(10,("ms_fnmatch(%s,%s) -> %d\n", pattern, string, ret)); + ret = ms_fnmatch_core(p, s, max_n, strrchr_w(s, UCS2_CHAR('.')), is_case_sensitive); + + if (max_n) { + free(max_n); + } return ret; } + /* a generic fnmatch function - uses for non-CIFS pattern matching */ int gen_fnmatch(const char *pattern, const char *string) { - return ms_fnmatch(pattern, string, PROTOCOL_NT1, True); + return ms_fnmatch(pattern, string, PROTOCOL_NT1, False); } diff --git a/source/lib/smbldap.c b/source/lib/smbldap.c index 57aab70a5ba..624ce22d22b 100644 --- a/source/lib/smbldap.c +++ b/source/lib/smbldap.c @@ -54,7 +54,7 @@ ATTRIB_MAP_ENTRY attrib_map_v22[] = { { LDAP_ATTR_CN, "cn" }, { LDAP_ATTR_DISPLAY_NAME, "displayName" }, { LDAP_ATTR_HOME_PATH, "smbHome" }, - { LDAP_ATTR_HOME_DRIVE, "homeDrives" }, + { LDAP_ATTR_HOME_DRIVE, "homeDrive" }, { LDAP_ATTR_LOGON_SCRIPT, "scriptPath" }, { LDAP_ATTR_PROFILE_PATH, "profilePath" }, { LDAP_ATTR_DESC, "description" }, diff --git a/source/lib/substitute.c b/source/lib/substitute.c index 44e791b7907..92eff625f39 100644 --- a/source/lib/substitute.c +++ b/source/lib/substitute.c @@ -446,7 +446,8 @@ static void standard_sub_advanced(int snum, const char *user, string_sub(p,"%P", connectpath, l); break; case 'S': - string_sub(p,"%S", lp_servicename(snum), l); + if ( snum != -1 ) + string_sub(p,"%S", lp_servicename(snum), l); break; case 'g': string_sub(p,"%g", gidtoname(gid), l); @@ -463,7 +464,8 @@ static void standard_sub_advanced(int snum, const char *user, * "path =" string in [homes] and so needs the * service name, not the username. */ case 'p': - string_sub(p,"%p", automount_path(lp_servicename(snum)), l); + if ( snum != -1 ) + string_sub(p,"%p", automount_path(lp_servicename(snum)), l); break; case '\0': p++; @@ -797,6 +799,6 @@ void standard_sub_snum(int snum, char *str, size_t len) cached_uid = current_user.uid; } - standard_sub_advanced(snum, cached_user, "", -1, + standard_sub_advanced(snum, cached_user, "", current_user.gid, smb_user_name, str, len); } diff --git a/source/lib/system.c b/source/lib/system.c index a0007ec83cd..b27ac5c00ad 100644 --- a/source/lib/system.c +++ b/source/lib/system.c @@ -1580,3 +1580,29 @@ int sys_fsetxattr (int filedes, const char *name, const void *value, size_t size return -1; #endif } + +/**************************************************************************** + Return the major devicenumber for UNIX extensions. +****************************************************************************/ + +uint32 unix_dev_major(SMB_DEV_T dev) +{ +#if defined(HAVE_DEVICE_MAJOR_FN) + return (uint32)major(dev); +#else + return (uint32)(dev >> 8); +#endif +} + +/**************************************************************************** + Return the minor devicenumber for UNIX extensions. +****************************************************************************/ + +uint32 unix_dev_minor(SMB_DEV_T dev) +{ +#if defined(HAVE_DEVICE_MINOR_FN) + return (uint32)minor(dev); +#else + return (uint32)(dev & 0xff); +#endif +} diff --git a/source/lib/util.c b/source/lib/util.c index a456395cad1..89cf1bfa021 100644 --- a/source/lib/util.c +++ b/source/lib/util.c @@ -289,6 +289,28 @@ BOOL in_group(gid_t group, gid_t current_gid, int ngroups, const gid_t *groups) } /**************************************************************************** + Add a gid to an array of gids if it's not already there. +****************************************************************************/ + +void add_gid_to_array_unique(gid_t gid, gid_t **gids, int *num) +{ + int i; + + for (i=0; i<*num; i++) { + if ((*gids)[i] == gid) + return; + } + + *gids = Realloc(*gids, (*num+1) * sizeof(gid_t)); + + if (*gids == NULL) + return; + + (*gids)[*num] = gid; + *num += 1; +} + +/**************************************************************************** Like atoi but gets the value up to the separator character. ****************************************************************************/ @@ -1700,17 +1722,59 @@ BOOL is_myname(const char *s) BOOL is_myname_or_ipaddr(const char *s) { + fstring name, dnsname; + char *servername; + + if ( !s ) + return False; + + /* santize the string from '\\name' */ + + fstrcpy( name, s ); + + servername = strrchr_m( name, '\\' ); + if ( !servername ) + servername = name; + else + servername++; + /* optimize for the common case */ - if (strequal(s, global_myname())) + + if (strequal(servername, global_myname())) return True; + /* check for an alias */ + + if (is_myname(servername)) + return True; + + /* maybe it's my dns name */ + + if ( get_mydnsfullname( dnsname ) ) + if ( strequal( servername, dnsname ) ) + return True; + + /* handle possible CNAME records */ + + if ( !is_ipaddress( servername ) ) { + /* use DNS to resolve the name, but only the first address */ + struct hostent *hp; + + if (((hp = sys_gethostbyname(name)) != NULL) && (hp->h_addr != NULL)) { + struct in_addr return_ip; + putip( (char*)&return_ip, (char*)hp->h_addr ); + fstrcpy( name, inet_ntoa( return_ip ) ); + servername = name; + } + } + /* maybe its an IP address? */ - if (is_ipaddress(s)) { + if (is_ipaddress(servername)) { struct iface_struct nics[MAX_INTERFACES]; int i, n; uint32 ip; - ip = interpret_addr(s); + ip = interpret_addr(servername); if ((ip==0) || (ip==0xffffffff)) return False; @@ -1721,10 +1785,6 @@ BOOL is_myname_or_ipaddr(const char *s) } } - /* check for an alias */ - if (is_myname(s)) - return True; - /* no match */ return False; } diff --git a/source/lib/util_smbd.c b/source/lib/util_smbd.c index 071f20b4162..36c3104e55a 100644 --- a/source/lib/util_smbd.c +++ b/source/lib/util_smbd.c @@ -37,29 +37,58 @@ NOTE! uses become_root() to gain correct priviages on systems that lack a native getgroups() call (uses initgroups and getgroups) */ -int getgroups_user(const char *user, gid_t **groups) +BOOL getgroups_user(const char *user, gid_t **ret_groups, int *ngroups) { struct passwd *pwd; int ngrp, max_grp; + gid_t *temp_groups; + gid_t *groups; + int i; pwd = getpwnam_alloc(user); - if (!pwd) return -1; + if (!pwd) return False; max_grp = groups_max(); - (*groups) = (gid_t *)malloc(sizeof(gid_t) * max_grp); - if (! *groups) { + temp_groups = (gid_t *)malloc(sizeof(gid_t) * max_grp); + if (! temp_groups) { passwd_free(&pwd); - errno = ENOMEM; - return -1; + return False; } - ngrp = sys_getgrouplist(user, pwd->pw_gid, *groups, &max_grp); - if (ngrp <= 0) { - passwd_free(&pwd); - free(*groups); - return ngrp; + if (sys_getgrouplist(user, pwd->pw_gid, temp_groups, &max_grp) == -1) { + + gid_t *groups_tmp; + + groups_tmp = Realloc(temp_groups, sizeof(gid_t) * max_grp); + + if (!groups_tmp) { + SAFE_FREE(temp_groups); + return False; + } + temp_groups = groups_tmp; + + if (sys_getgrouplist(user, pwd->pw_gid, temp_groups, &max_grp) == -1) { + DEBUG(0, ("get_user_groups: failed to get the unix group list\n")); + passwd_free(&pwd); + SAFE_FREE(temp_groups); + return False; + } } + + ngrp = 0; + groups = NULL; + + /* Add in primary group first */ + add_gid_to_array_unique(pwd->pw_gid, &groups, &ngrp); passwd_free(&pwd); - return ngrp; + + for (i=0; i<max_grp; i++) + add_gid_to_array_unique(temp_groups[i], &groups, &ngrp); + + *ngroups = ngrp; + *ret_groups = groups; + SAFE_FREE(temp_groups); + return True; } + diff --git a/source/lib/util_sock.c b/source/lib/util_sock.c index 4b9881a4499..8c16533bf96 100644 --- a/source/lib/util_sock.c +++ b/source/lib/util_sock.c @@ -43,7 +43,7 @@ static char *get_socket_addr(int fd) } if (getsockname(fd, &sa, &length) < 0) { - DEBUG(0,("getpeername failed. Error was %s\n", strerror(errno) )); + DEBUG(0,("getsockname failed. Error was %s\n", strerror(errno) )); return addr_buf; } diff --git a/source/lib/util_str.c b/source/lib/util_str.c index 65a616ad419..a758aece4ca 100644 --- a/source/lib/util_str.c +++ b/source/lib/util_str.c @@ -1208,6 +1208,12 @@ char *strchr_m(const char *src, char c) smb_ucs2_t *p; const char *s; + /* characters below 0x3F are guaranteed to not appear in + non-initial position in multi-byte charsets */ + if ((c & 0xC0) == 0) { + return strchr(src, c); + } + /* this is quite a common operation, so we want it to be fast. We optimise for the ascii case, knowing that all our supported multi-byte character sets are ascii-compatible @@ -1237,6 +1243,12 @@ char *strchr_m(const char *src, char c) char *strrchr_m(const char *s, char c) { + /* characters below 0x3F are guaranteed to not appear in + non-initial position in multi-byte charsets */ + if ((c & 0xC0) == 0) { + return strrchr(s, c); + } + /* this is quite a common operation, so we want it to be fast. We optimise for the ascii case, knowing that all our supported multi-byte character sets are ascii-compatible diff --git a/source/lib/xfile.c b/source/lib/xfile.c index 1534dd855e9..da5ec126c1f 100644 --- a/source/lib/xfile.c +++ b/source/lib/xfile.c @@ -135,7 +135,12 @@ int x_fclose(XFILE *f) memset(f->buf, 0, f->bufsize); SAFE_FREE(f->buf); } - SAFE_FREE(f); + /* check the file descriptor given to the function is NOT one of the static + * descriptor of this libreary or we will free unallocated memory + * --sss */ + if (f != x_stdin && f != x_stdout && f != x_stderr) { + SAFE_FREE(f); + } return ret; } diff --git a/source/libads/ldap.c b/source/libads/ldap.c index d1539b83da7..e5d2dfb8d3f 100644 --- a/source/libads/ldap.c +++ b/source/libads/ldap.c @@ -995,12 +995,23 @@ ADS_STATUS ads_del_dn(ADS_STRUCT *ads, char *del_dn) * Build an org unit string * if org unit is Computers or blank then assume a container, otherwise * assume a \ separated list of organisational units + * @param ads connection to ads server * @param org_unit Organizational unit * @return org unit string - caller must free **/ -char *ads_ou_string(const char *org_unit) -{ - if (!org_unit || !*org_unit || strequal(org_unit, "Computers")) { +char *ads_ou_string(ADS_STRUCT *ads, const char *org_unit) +{ + char *ret = NULL; + + if (!org_unit || !*org_unit) { + + ret = ads_default_ou_string(ads, WELL_KNOWN_GUID_COMPUTERS); + + /* samba4 might not yet respond to a wellknownobject-query */ + return ret ? ret : strdup("cn=Computers"); + } + + if (strequal(org_unit, "Computers")) { return strdup("cn=Computers"); } @@ -1008,6 +1019,64 @@ char *ads_ou_string(const char *org_unit) } /** + * Get a org unit string for a well-known GUID + * @param ads connection to ads server + * @param wknguid Well known GUID + * @return org unit string - caller must free + **/ +char *ads_default_ou_string(ADS_STRUCT *ads, const char *wknguid) +{ + ADS_STATUS status; + void *res; + char *base, *wkn_dn, *ret, **wkn_dn_exp, **bind_dn_exp; + const char *attrs[] = {"distinguishedName", NULL}; + int new_ln, wkn_ln, bind_ln, i; + + if (wknguid == NULL) { + return NULL; + } + + if (asprintf(&base, "<WKGUID=%s,%s>", wknguid, ads->config.bind_path ) == -1) { + DEBUG(1, ("asprintf failed!\n")); + return NULL; + } + + status = ads_search_dn(ads, &res, base, attrs); + if (!ADS_ERR_OK(status)) { + DEBUG(1,("Failed while searching for: %s\n", base)); + return NULL; + } + free(base); + + if (ads_count_replies(ads, res) != 1) { + return NULL; + } + + /* substitute the bind-path from the well-known-guid-search result */ + wkn_dn = ads_get_dn(ads, res); + wkn_dn_exp = ldap_explode_dn(wkn_dn, 0); + bind_dn_exp = ldap_explode_dn(ads->config.bind_path, 0); + + for (wkn_ln=0; wkn_dn_exp[wkn_ln]; wkn_ln++) + ; + for (bind_ln=0; bind_dn_exp[bind_ln]; bind_ln++) + ; + + new_ln = wkn_ln - bind_ln; + + ret = wkn_dn_exp[0]; + + for (i=1; i < new_ln; i++) { + char *s; + asprintf(&s, "%s,%s", ret, wkn_dn_exp[i]); + ret = strdup(s); + free(s); + } + + return ret; +} + +/** * Adds (appends) an item to an attribute array, rather then * replacing the whole list * @param ctx An initialized TALLOC_CTX @@ -1283,7 +1352,7 @@ static ADS_STATUS ads_add_machine_acct(ADS_STRUCT *ads, const char *machine_name machine_name)); exists=1; } else { - char *ou_str = ads_ou_string(org_unit); + char *ou_str = ads_ou_string(ads,org_unit); if (!ou_str) { DEBUG(1, ("ads_add_machine_acct: ads_ou_string returned NULL (malloc failure?)\n")); goto done; diff --git a/source/libsmb/clifile.c b/source/libsmb/clifile.c index ff0edc6bb4e..144fc4a0c85 100644 --- a/source/libsmb/clifile.c +++ b/source/libsmb/clifile.c @@ -77,7 +77,7 @@ static BOOL cli_link_internal(struct cli_state *cli, const char *oldname, const Map standard UNIX permissions onto wire representations. ****************************************************************************/ -uint32 unix_perms_to_wire(mode_t perms) +uint32 unix_perms_to_wire(mode_t perms) { unsigned int ret = 0; @@ -103,6 +103,141 @@ uint32 unix_perms_to_wire(mode_t perms) } /**************************************************************************** + Map wire permissions to standard UNIX. +****************************************************************************/ + +mode_t wire_perms_to_unix(uint32 perms) +{ + mode_t ret = (mode_t)0; + + ret |= ((perms & UNIX_X_OTH) ? S_IXOTH : 0); + ret |= ((perms & UNIX_W_OTH) ? S_IWOTH : 0); + ret |= ((perms & UNIX_R_OTH) ? S_IROTH : 0); + ret |= ((perms & UNIX_X_GRP) ? S_IXGRP : 0); + ret |= ((perms & UNIX_W_GRP) ? S_IWGRP : 0); + ret |= ((perms & UNIX_R_GRP) ? S_IRGRP : 0); + ret |= ((perms & UNIX_X_USR) ? S_IXUSR : 0); + ret |= ((perms & UNIX_W_USR) ? S_IWUSR : 0); + ret |= ((perms & UNIX_R_USR) ? S_IRUSR : 0); +#ifdef S_ISVTX + ret |= ((perms & UNIX_STICKY) ? S_ISVTX : 0); +#endif +#ifdef S_ISGID + ret |= ((perms & UNIX_SET_GID) ? S_ISGID : 0); +#endif +#ifdef S_ISUID + ret |= ((perms & UNIX_SET_UID) ? S_ISUID : 0); +#endif + return ret; +} + +/**************************************************************************** + Return the file type from the wire filetype for UNIX extensions. +****************************************************************************/ + +static mode_t unix_filetype_from_wire(uint32 wire_type) +{ + switch (wire_type) { + case UNIX_TYPE_FILE: + return S_IFREG; + case UNIX_TYPE_DIR: + return S_IFDIR; +#ifdef S_IFLNK + case UNIX_TYPE_SYMLINK: + return S_IFLNK; +#endif +#ifdef S_IFCHR + case UNIX_TYPE_CHARDEV: + return S_IFCHR; +#endif +#ifdef S_IFBLK + case UNIX_TYPE_BLKDEV: + return S_IFBLK; +#endif +#ifdef S_IFIFO + case UNIX_TYPE_FIFO: + return S_IFIFO; +#endif +#ifdef S_IFSOCK + case UNIX_TYPE_SOCKET: + return S_IFSOCK; +#endif + default: + return (mode_t)0; + } +} + +/**************************************************************************** + Stat a file (UNIX extensions). +****************************************************************************/ + +BOOL cli_unix_stat(struct cli_state *cli, const char *name, SMB_STRUCT_STAT *sbuf) +{ + unsigned int param_len = 0; + unsigned int data_len = 0; + uint16 setup = TRANSACT2_QPATHINFO; + char param[sizeof(pstring)+6]; + char *rparam=NULL, *rdata=NULL; + char *p; + + ZERO_STRUCTP(sbuf); + + p = param; + memset(p, 0, 6); + SSVAL(p, 0, SMB_QUERY_FILE_UNIX_BASIC); + p += 6; + p += clistr_push(cli, p, name, sizeof(pstring)-6, STR_TERMINATE); + param_len = PTR_DIFF(p, param); + + if (!cli_send_trans(cli, SMBtrans2, + NULL, /* name */ + -1, 0, /* fid, flags */ + &setup, 1, 0, /* setup, length, max */ + param, param_len, 2, /* param, length, max */ + NULL, 0, cli->max_xmit /* data, length, max */ + )) { + return False; + } + + if (!cli_receive_trans(cli, SMBtrans2, + &rparam, ¶m_len, + &rdata, &data_len)) { + return False; + } + + if (data_len < 96) { + SAFE_FREE(rdata); + SAFE_FREE(rparam); + return False; + } + + sbuf->st_size = IVAL2_TO_SMB_BIG_UINT(rdata,0); /* total size, in bytes */ + sbuf->st_blocks = IVAL2_TO_SMB_BIG_UINT(rdata,8); /* number of blocks allocated */ + sbuf->st_blocks /= STAT_ST_BLOCKSIZE; + sbuf->st_ctime = interpret_long_date(rdata + 16); /* time of last change */ + sbuf->st_atime = interpret_long_date(rdata + 24); /* time of last access */ + sbuf->st_mtime = interpret_long_date(rdata + 32); /* time of last modification */ + sbuf->st_uid = IVAL(rdata,40); /* user ID of owner */ + sbuf->st_gid = IVAL(rdata,48); /* group ID of owner */ + sbuf->st_mode |= unix_filetype_from_wire(IVAL(rdata, 56)); +#if defined(HAVE_MAKEDEV) + { + uint32 dev_major = IVAL(rdata,60); + uint32 dev_minor = IVAL(rdata,68); + sbuf->st_rdev = makedev(dev_major, dev_minor); + } +#endif + sbuf->st_ino = (SMB_INO_T)IVAL2_TO_SMB_BIG_UINT(rdata,76); /* inode */ + sbuf->st_mode |= wire_perms_to_unix(IVAL(rdata,84)); /* protection */ + sbuf->st_nlink = IVAL(rdata,92); /* number of hard links */ + + SAFE_FREE(rdata); + SAFE_FREE(rparam); + + return True; +} + +/**************************************************************************** Symlink a file (UNIX extensions). ****************************************************************************/ diff --git a/source/libsmb/clireadwrite.c b/source/libsmb/clireadwrite.c index 3f14e530943..d1a23d36c8b 100644 --- a/source/libsmb/clireadwrite.c +++ b/source/libsmb/clireadwrite.c @@ -318,9 +318,9 @@ static BOOL cli_issue_write(struct cli_state *cli, int fnum, off_t offset, 0x0008 start of message mode named pipe protocol ****************************************************************************/ -ssize_t cli_write(struct cli_state *cli, - int fnum, uint16 write_mode, - const char *buf, off_t offset, size_t size) +size_t cli_write(struct cli_state *cli, + int fnum, uint16 write_mode, + const char *buf, off_t offset, size_t size) { int bwritten = 0; int issued = 0; @@ -358,7 +358,7 @@ ssize_t cli_write(struct cli_state *cli, break; bwritten += SVAL(cli->inbuf, smb_vwv2); - bwritten += (((int)(SVAL(cli->inbuf, smb_vwv4)))>>16); + bwritten += (((int)(SVAL(cli->inbuf, smb_vwv4)))<<16); } while (received < issued && cli_receive_smb(cli)) diff --git a/source/libsmb/clisecdesc.c b/source/libsmb/clisecdesc.c index 2989966f4de..b79ea9d14ba 100644 --- a/source/libsmb/clisecdesc.c +++ b/source/libsmb/clisecdesc.c @@ -53,6 +53,9 @@ SEC_DESC *cli_query_secdesc(struct cli_state *cli, int fnum, goto cleanup; } + if (cli_is_error(cli)) + goto cleanup; + prs_init(&pd, rdata_count, mem_ctx, UNMARSHALL); prs_copy_data_in(&pd, rdata, rdata_count); prs_set_offset(&pd,0); diff --git a/source/libsmb/doserr.c b/source/libsmb/doserr.c index c6348568cf9..96c052c7c56 100644 --- a/source/libsmb/doserr.c +++ b/source/libsmb/doserr.c @@ -68,6 +68,7 @@ werror_code_struct dos_errs[] = { "WERR_INVALID_SECURITY_DESCRIPTOR", WERR_INVALID_SECURITY_DESCRIPTOR }, { "WERR_INVALID_OWNER", WERR_INVALID_OWNER }, { "WERR_SERVER_UNAVAILABLE", WERR_SERVER_UNAVAILABLE }, + { "WERR_IO_PENDING", WERR_IO_PENDING }, { NULL, W_ERROR(0) } }; diff --git a/source/libsmb/libsmb_cache.c b/source/libsmb/libsmb_cache.c index cb40b4aaa6b..caf226c5a6a 100644 --- a/source/libsmb/libsmb_cache.c +++ b/source/libsmb/libsmb_cache.c @@ -27,7 +27,7 @@ * Define this to get the real SMBCFILE and SMBCSRV structures */ #define _SMBC_INTERNAL -#include "../include/libsmbclient.h" +#include "include/libsmbclient.h" /* * Structure we use if internal caching mechanism is used diff --git a/source/libsmb/libsmb_compat.c b/source/libsmb/libsmb_compat.c index cc23835ae3d..c4be848cc17 100644 --- a/source/libsmb/libsmb_compat.c +++ b/source/libsmb/libsmb_compat.c @@ -25,7 +25,7 @@ #include "includes.h" -#include "../include/libsmb_internal.h" +#include "include/libsmb_internal.h" struct smbc_compat_fdlist { SMBCFILE * file; diff --git a/source/libsmb/libsmbclient.c b/source/libsmb/libsmbclient.c index e44bdea2d3d..2b0115eaaa4 100644 --- a/source/libsmb/libsmbclient.c +++ b/source/libsmb/libsmbclient.c @@ -24,7 +24,7 @@ #include "includes.h" -#include "../include/libsmb_internal.h" +#include "include/libsmb_internal.h" /* * Internal flags for extended attributes @@ -596,6 +596,7 @@ SMBCSRV *smbc_server(SMBCCTX *context, */ c.port = 445; if (!cli_connect(&c, server_n, &ip)) { + cli_shutdown(&c); errno = ENETUNREACH; return NULL; } diff --git a/source/libsmb/namequery.c b/source/libsmb/namequery.c index cee0015e257..2e6842088a4 100644 --- a/source/libsmb/namequery.c +++ b/source/libsmb/namequery.c @@ -855,22 +855,35 @@ static BOOL resolve_lmhosts(const char *name, int name_type, fp = startlmhosts(dyn_LMHOSTSFILE); if(fp) { - while (getlmhostsent(fp, lmhost_name, &name_type2, &return_ip)) { - if (strequal(name, lmhost_name) && - ((name_type2 == -1) || (name_type == name_type2)) - ) { - endlmhosts(fp); - if ( (*return_iplist = (struct ip_service *)malloc(sizeof(struct ip_service))) == NULL ) { - DEBUG(3,("resolve_lmhosts: malloc fail !\n")); - return False; - } - (*return_iplist)[0].ip = return_ip; - (*return_iplist)[0].port = PORT_NONE; - *return_count = 1; - return True; + while (getlmhostsent(fp, lmhost_name, &name_type2, + &return_ip)) { + + if (!strequal(name, lmhost_name)) + continue; + + if ((name_type2 != -1) && (name_type != name_type2)) + continue; + + *return_iplist = (struct ip_service *) + realloc((*return_iplist), + sizeof(struct ip_service) * + ((*return_count)+1)); + + if ((*return_iplist) == NULL) { + DEBUG(3,("resolve_lmhosts: malloc fail !\n")); + return False; } + + (*return_iplist)[*return_count].ip = return_ip; + (*return_iplist)[*return_count].port = PORT_NONE; + *return_count += 1; + + /* Multiple names only for DC lookup */ + if (name_type != 0x1c) + break; } endlmhosts(fp); + return True; } return False; } diff --git a/source/libsmb/ntlm_check.c b/source/libsmb/ntlm_check.c index 1d02b03e0c3..a0ca08fb891 100644 --- a/source/libsmb/ntlm_check.c +++ b/source/libsmb/ntlm_check.c @@ -63,7 +63,7 @@ static BOOL smb_pwd_check_ntlmv1(const DATA_BLOB *nt_response, } -#if DEBUG_PASSWORD +#ifdef DEBUG_PASSWORD DEBUG(100,("Part password (P16) was |\n")); dump_data(100, part_passwd, 16); DEBUGADD(100,("Password from client was |\n")); diff --git a/source/locking/brlock.c b/source/locking/brlock.c index 990a6a25d2f..61144eb59a9 100644 --- a/source/locking/brlock.c +++ b/source/locking/brlock.c @@ -92,6 +92,28 @@ static BOOL brl_same_context(struct lock_context *ctx1, } /**************************************************************************** + See if lck1 and lck2 overlap. +****************************************************************************/ + +static BOOL brl_overlap(struct lock_struct *lck1, + struct lock_struct *lck2) +{ + /* this extra check is not redundent - it copes with locks + that go beyond the end of 64 bit file space */ + if (lck1->size != 0 && + lck1->start == lck2->start && + lck1->size == lck2->size) { + return True; + } + + if (lck1->start >= (lck2->start+lck2->size) || + lck2->start >= (lck1->start+lck1->size)) { + return False; + } + return True; +} + +/**************************************************************************** See if lock2 can be added when lock1 is in place. ****************************************************************************/ @@ -115,7 +137,7 @@ static BOOL brl_conflict(struct lock_struct *lck1, return False; } - return True; + return brl_overlap(lck1, lck2); } #if ZERO_ZERO @@ -175,9 +197,36 @@ static BOOL brl_conflict_other(struct lock_struct *lck1, struct lock_struct *lck lck2->start >= (lck1->start + lck1->size)) return False; - return True; + return brl_overlap(lck1, lck2); } +/**************************************************************************** + Amazingly enough, w2k3 "remembers" whether the last lock failure + is the same as this one and changes its error code. I wonder if any + app depends on this ? +****************************************************************************/ + +static NTSTATUS brl_lock_failed(struct lock_struct *lock) +{ + static struct lock_struct last_lock_failure; + + if (brl_same_context(&lock->context, &last_lock_failure.context) && + lock->fnum == last_lock_failure.fnum && + lock->start == last_lock_failure.start && + lock->size == last_lock_failure.size) { + return NT_STATUS_FILE_LOCK_CONFLICT; + } + last_lock_failure = *lock; + if (lock->start >= 0xEF000000 && + (lock->start >> 63) == 0) { + /* amazing the little things you learn with a test + suite. Locks beyond this offset (as a 64 bit + number!) always generate the conflict error code, + unless the top bit is set */ + return NT_STATUS_FILE_LOCK_CONFLICT; + } + return NT_STATUS_LOCK_NOT_GRANTED; +} #if DONT_DO_THIS /* doing this traversal could kill solaris machines under high load (tridge) */ @@ -313,8 +362,6 @@ NTSTATUS brl_lock(SMB_DEV_T dev, SMB_INO_T ino, int fnum, struct lock_struct lock, *locks; char *tp; NTSTATUS status = NT_STATUS_OK; - static int last_failed = -1; - static br_off last_failed_start; *my_lock_ctx = False; kbuf = locking_key(dev,ino); @@ -344,7 +391,7 @@ NTSTATUS brl_lock(SMB_DEV_T dev, SMB_INO_T ino, int fnum, count = dbuf.dsize / sizeof(*locks); for (i=0; i<count; i++) { if (brl_conflict(&locks[i], &lock)) { - status = NT_STATUS_LOCK_NOT_GRANTED; + status = brl_lock_failed(&lock);; /* Did we block ourselves ? */ if (brl_same_context(&locks[i].context, &lock.context)) *my_lock_ctx = True; @@ -375,24 +422,16 @@ NTSTATUS brl_lock(SMB_DEV_T dev, SMB_INO_T ino, int fnum, qsort(dbuf.dptr, dbuf.dsize/sizeof(lock), sizeof(lock), lock_compare); #endif - tdb_store(tdb, kbuf, dbuf, TDB_REPLACE); + if (tdb_store(tdb, kbuf, dbuf, TDB_REPLACE) != 0) { + status = NT_STATUS_INTERNAL_DB_CORRUPTION; + goto fail; + } SAFE_FREE(dbuf.dptr); tdb_chainunlock(tdb, kbuf); return NT_STATUS_OK; fail: - /* this is a nasty hack to try to simulate the lock result cache code in w2k. - It isn't completely accurate as I haven't yet worked out the correct - semantics (tridge) - */ - if (last_failed == fnum && - last_failed_start == start && - NT_STATUS_EQUAL(status, NT_STATUS_LOCK_NOT_GRANTED)) { - status = NT_STATUS_FILE_LOCK_CONFLICT; - } - last_failed = fnum; - last_failed_start = start; SAFE_FREE(dbuf.dptr); tdb_chainunlock(tdb, kbuf); @@ -563,7 +602,6 @@ BOOL brl_locktest(SMB_DEV_T dev, SMB_INO_T ino, int fnum, dbuf.dptr = NULL; - tdb_chainlock(tdb, kbuf); dbuf = tdb_fetch(tdb, kbuf); lock.context.smbpid = smbpid; @@ -594,12 +632,10 @@ BOOL brl_locktest(SMB_DEV_T dev, SMB_INO_T ino, int fnum, /* no conflicts - we could have added it */ SAFE_FREE(dbuf.dptr); - tdb_chainunlock(tdb, kbuf); return True; fail: SAFE_FREE(dbuf.dptr); - tdb_chainunlock(tdb, kbuf); return False; } diff --git a/source/locking/posix.c b/source/locking/posix.c index 6173c80b2fd..0e5edfa0eb8 100644 --- a/source/locking/posix.c +++ b/source/locking/posix.c @@ -238,7 +238,7 @@ int fd_close_posix(struct connection_struct *conn, files_struct *fsp) if (!add_fd_to_close_entry(fsp)) { SAFE_FREE(entries); - return False; + return -1; } SAFE_FREE(entries); @@ -281,9 +281,9 @@ int fd_close_posix(struct connection_struct *conn, files_struct *fsp) ret = SMB_VFS_CLOSE(fsp,fsp->fd); if (saved_errno != 0) { - errno = saved_errno; + errno = saved_errno; ret = -1; - } + } fsp->fd = -1; diff --git a/source/nsswitch/pam_winbind.c b/source/nsswitch/pam_winbind.c index 64e21738221..9d4f0954ceb 100644 --- a/source/nsswitch/pam_winbind.c +++ b/source/nsswitch/pam_winbind.c @@ -45,7 +45,9 @@ static int _pam_parse(int argc, const char **argv) ctrl |= WINBIND_TRY_FIRST_PASS_ARG; else if (!strcasecmp(*argv, "unknown_ok")) ctrl |= WINBIND_UNKNOWN_OK_ARG; - else if (!strncasecmp(*argv, "required_membership", strlen("required_membership"))) + else if (!strncasecmp(*argv, "require_membership_of", strlen("require_membership_of"))) + ctrl |= WINBIND_REQUIRED_MEMBERSHIP; + else if (!strncasecmp(*argv, "require-membership-of", strlen("require-membership-of"))) ctrl |= WINBIND_REQUIRED_MEMBERSHIP; else { _pam_log(LOG_ERR, "pam_parse: unknown option; %s", *argv); @@ -213,28 +215,28 @@ static int winbind_auth_request(const char *user, const char *pass, const char * /* lookup name? */ if (!strncmp("S-", member, 2) == 0) { - struct winbindd_request request; - struct winbindd_response response; + struct winbindd_request sid_request; + struct winbindd_response sid_response; - ZERO_STRUCT(request); - ZERO_STRUCT(response); + ZERO_STRUCT(sid_request); + ZERO_STRUCT(sid_response); if (ctrl & WINBIND_DEBUG_ARG) _pam_log(LOG_DEBUG, "no sid given, looking up: %s\n", member); /* fortunatly winbindd can handle non-separated names */ - strcpy(request.data.name.name, member); + strcpy(sid_request.data.name.name, member); - if (pam_winbind_request_log(WINBINDD_LOOKUPNAME, &request, &response, ctrl, user)) { + if (pam_winbind_request_log(WINBINDD_LOOKUPNAME, &sid_request, &sid_response, ctrl, user)) { _pam_log(LOG_INFO, "could not lookup name: %s\n", member); return PAM_AUTH_ERR; } - member = strdup(response.data.sid.sid); + member = sid_response.data.sid.sid; } - strncpy(request.data.auth.required_membership_sid, member, - sizeof(request.data.auth.required_membership_sid)-1); + strncpy(request.data.auth.require_membership_of_sid, member, + sizeof(request.data.auth.require_membership_of_sid)-1); return pam_winbind_request_log(WINBINDD_PAM_AUTH, &request, &response, ctrl, user); } @@ -488,13 +490,14 @@ int pam_sm_authenticate(pam_handle_t *pamh, int flags, /* Retrieve membership-string here */ for ( i=0; i<argc; i++ ) { - if (!strncmp(argv[i], "required_membership", strlen("required_membership"))) { + if ((strncmp(argv[i], "require_membership_of", strlen("require_membership_of")) == 0) + || (strncmp(argv[i], "require-membership-of", strlen("require-membership-of")) == 0)) { char *p; char *parm = strdup(argv[i]); if ( (p = strchr( parm, '=' )) == NULL) { - _pam_log(LOG_INFO, "no \"=\" delimiter for \"required_membership\" found\n"); + _pam_log(LOG_INFO, "no \"=\" delimiter for \"require_membership_of\" found\n"); break; } diff --git a/source/nsswitch/wbinfo.c b/source/nsswitch/wbinfo.c index b6a09bf2a1f..69f464f446a 100644 --- a/source/nsswitch/wbinfo.c +++ b/source/nsswitch/wbinfo.c @@ -567,28 +567,61 @@ static BOOL wbinfo_auth_crap(char *username) parse_wbinfo_domain_user(username, name_domain, name_user); - if (push_utf8_fstring(request.data.auth_crap.user, name_user) == -1) { - d_printf("unable to create utf8 string for '%s'\n", - name_user); - return False; - } + fstrcpy(request.data.auth_crap.user, name_user); - if (push_utf8_fstring(request.data.auth_crap.domain, - name_domain) == -1) { - d_printf("unable to create utf8 string for '%s'\n", - name_domain); - return False; - } + fstrcpy(request.data.auth_crap.domain, + name_domain); generate_random_buffer(request.data.auth_crap.chal, 8); - SMBencrypt(pass, request.data.auth_crap.chal, - (uchar *)request.data.auth_crap.lm_resp); - SMBNTencrypt(pass, request.data.auth_crap.chal, - (uchar *)request.data.auth_crap.nt_resp); + if (lp_client_ntlmv2_auth()) { + DATA_BLOB server_chal; + DATA_BLOB names_blob; + + DATA_BLOB lm_response; + DATA_BLOB nt_response; + + server_chal = data_blob(request.data.auth_crap.chal, 8); + + /* Pretend this is a login to 'us', for blob purposes */ + names_blob = NTLMv2_generate_names_blob(global_myname(), lp_workgroup()); + + if (!SMBNTLMv2encrypt(name_user, name_domain, pass, &server_chal, + &names_blob, + &lm_response, &nt_response, NULL)) { + data_blob_free(&names_blob); + data_blob_free(&server_chal); + return False; + } + data_blob_free(&names_blob); + data_blob_free(&server_chal); + + memcpy(request.data.auth_crap.nt_resp, nt_response.data, + MIN(nt_response.length, + sizeof(request.data.auth_crap.nt_resp))); + request.data.auth_crap.nt_resp_len = nt_response.length; + + memcpy(request.data.auth_crap.lm_resp, lm_response.data, + MIN(lm_response.length, + sizeof(request.data.auth_crap.lm_resp))); + request.data.auth_crap.lm_resp_len = lm_response.length; + + data_blob_free(&nt_response); + data_blob_free(&lm_response); - request.data.auth_crap.lm_resp_len = 24; - request.data.auth_crap.nt_resp_len = 24; + } else { + if (lp_client_lanman_auth() + && SMBencrypt(pass, request.data.auth_crap.chal, + (uchar *)request.data.auth_crap.lm_resp)) { + request.data.auth_crap.lm_resp_len = 24; + } else { + request.data.auth_crap.lm_resp_len = 0; + } + SMBNTencrypt(pass, request.data.auth_crap.chal, + (uchar *)request.data.auth_crap.nt_resp); + + request.data.auth_crap.nt_resp_len = 24; + } result = winbindd_request(WINBINDD_PAM_AUTH_CRAP, &request, &response); diff --git a/source/nsswitch/winbind_nss_aix.c b/source/nsswitch/winbind_nss_aix.c index 3e00e54e5c4..c90dc2f3f10 100644 --- a/source/nsswitch/winbind_nss_aix.c +++ b/source/nsswitch/winbind_nss_aix.c @@ -159,12 +159,13 @@ static unsigned decode_id(const char *name) return id; } +static struct passwd *wb_aix_getpwuid(uid_t uid); + static char *decode_user(const char *name) { struct passwd *pwd; unsigned id; char *ret; - static struct passwd *wb_aix_getpwuid(uid_t uid); sscanf(name+1, "%u", &id); pwd = wb_aix_getpwuid(id); @@ -741,6 +742,7 @@ static void wb_aix_close(void *token) return; } +#ifdef HAVE_STRUCT_SECMETHOD_TABLE_METHOD_ATTRLIST /* return a list of additional attributes supported by the backend */ @@ -764,6 +766,7 @@ static attrlist_t **wb_aix_attrlist(void) return ret; } +#endif /* @@ -977,7 +980,9 @@ int wb_aix_init(struct secmethod_table *methods) { ZERO_STRUCTP(methods); +#ifdef HAVE_STRUCT_SECMETHOD_TABLE_METHOD_VERSION methods->method_version = SECMETHOD_VERSION_520; +#endif methods->method_getgrgid = wb_aix_getgrgid; methods->method_getgrnam = wb_aix_getgrnam; @@ -997,7 +1002,9 @@ int wb_aix_init(struct secmethod_table *methods) methods->method_passwdrestrictions = wb_aix_passwdrestrictions; methods->method_getgracct = wb_aix_getgracct; methods->method_getgrusers = wb_aix_getgrusers; +#ifdef HAVE_STRUCT_SECMETHOD_TABLE_METHOD_ATTRLIST methods->method_attrlist = wb_aix_attrlist; +#endif #if LOG_UNIMPLEMENTED_CALLS methods->method_delgroup = method_delgroup; diff --git a/source/nsswitch/winbindd.h b/source/nsswitch/winbindd.h index 751f6f3700f..477d2e0f682 100644 --- a/source/nsswitch/winbindd.h +++ b/source/nsswitch/winbindd.h @@ -230,7 +230,7 @@ struct winbindd_idmap_methods { void (*status)(void); }; -#include "../nsswitch/winbindd_proto.h" +#include "nsswitch/winbindd_proto.h" #include "rpc_parse.h" #include "rpc_client.h" diff --git a/source/nsswitch/winbindd_cache.c b/source/nsswitch/winbindd_cache.c index 493255a5a65..a6ebafca965 100644 --- a/source/nsswitch/winbindd_cache.c +++ b/source/nsswitch/winbindd_cache.c @@ -751,8 +751,8 @@ do_query: if (domain->backend->consistent) { /* when the backend is consistent we can pre-prime some mappings */ wcache_save_name_to_sid(domain, NT_STATUS_OK, - (*info)[i].acct_name, domain->name, + (*info)[i].acct_name, (*info)[i].user_sid, SID_NAME_USER); wcache_save_sid_to_name(domain, NT_STATUS_OK, diff --git a/source/nsswitch/winbindd_group.c b/source/nsswitch/winbindd_group.c index a3b826278b5..8ab5150bbe3 100644 --- a/source/nsswitch/winbindd_group.c +++ b/source/nsswitch/winbindd_group.c @@ -919,24 +919,6 @@ enum winbindd_result winbindd_list_groups(struct winbindd_cli_state *state) return WINBINDD_OK; } -static void add_gid_to_array_unique(gid_t gid, gid_t **gids, int *num) -{ - int i; - - for (i=0; i<*num; i++) { - if ((*gids)[i] == gid) - return; - } - - *gids = Realloc(*gids, (*num+1) * sizeof(gid_t)); - - if (*gids == NULL) - return; - - (*gids)[*num] = gid; - *num += 1; -} - static void add_local_gids_from_sid(DOM_SID *sid, gid_t **gids, int *num) { gid_t gid; diff --git a/source/nsswitch/winbindd_nss.h b/source/nsswitch/winbindd_nss.h index 6a457f38004..9a99bad9d74 100644 --- a/source/nsswitch/winbindd_nss.h +++ b/source/nsswitch/winbindd_nss.h @@ -181,7 +181,7 @@ struct winbindd_request { character is. */ fstring user; fstring pass; - fstring required_membership_sid; + fstring require_membership_of_sid; } auth; /* pam_winbind auth module */ struct { unsigned char chal[8]; @@ -192,7 +192,7 @@ struct winbindd_request { fstring nt_resp; uint16 nt_resp_len; fstring workstation; - fstring required_membership_sid; + fstring require_membership_of_sid; } auth_crap; struct { fstring user; diff --git a/source/nsswitch/winbindd_pam.c b/source/nsswitch/winbindd_pam.c index 129f876f817..e13649afe15 100644 --- a/source/nsswitch/winbindd_pam.c +++ b/source/nsswitch/winbindd_pam.c @@ -59,7 +59,7 @@ static NTSTATUS check_info3_in_group(TALLOC_CTX *mem_ctx, NET_USER_INFO_3 *info3, const char *group_sid) { - DOM_SID required_membership_sid; + DOM_SID require_membership_of_sid; DOM_SID *all_sids; size_t num_all_sids = (2 + info3->num_groups2 + info3->num_other_sids); size_t i, j = 0; @@ -71,7 +71,7 @@ static NTSTATUS check_info3_in_group(TALLOC_CTX *mem_ctx, return NT_STATUS_OK; } - if (!string_to_sid(&required_membership_sid, group_sid)) { + if (!string_to_sid(&require_membership_of_sid, group_sid)) { DEBUG(0, ("check_info3_in_group: could not parse %s as a SID!", group_sid)); @@ -133,9 +133,9 @@ static NTSTATUS check_info3_in_group(TALLOC_CTX *mem_ctx, fstring sid1, sid2; DEBUG(10, ("User has SID: %s\n", sid_to_string(sid1, &all_sids[i]))); - if (sid_equal(&required_membership_sid, &all_sids[i])) { + if (sid_equal(&require_membership_of_sid, &all_sids[i])) { DEBUG(10, ("SID %s matches %s - user permitted to authenticate!\n", - sid_to_string(sid1, &required_membership_sid), sid_to_string(sid2, &all_sids[i]))); + sid_to_string(sid1, &require_membership_of_sid), sid_to_string(sid2, &all_sids[i]))); return NT_STATUS_OK; } } @@ -190,13 +190,59 @@ enum winbindd_result winbindd_pam_auth(struct winbindd_cli_state *state) /* do password magic */ + generate_random_buffer(chal, 8); - SMBencrypt(state->request.data.auth.pass, chal, local_lm_response); + if (lp_client_ntlmv2_auth()) { + DATA_BLOB server_chal; + DATA_BLOB names_blob; + DATA_BLOB nt_response; + DATA_BLOB lm_response; + server_chal = data_blob_talloc(mem_ctx, chal, 8); + + /* note that the 'workgroup' here is a best guess - we don't know + the server's domain at this point. The 'server name' is also + dodgy... + */ + names_blob = NTLMv2_generate_names_blob(global_myname(), lp_workgroup()); - SMBNTencrypt(state->request.data.auth.pass, chal, local_nt_response); + if (!SMBNTLMv2encrypt(name_user, name_domain, + state->request.data.auth.pass, + &server_chal, + &names_blob, + &lm_response, &nt_response, NULL)) { + data_blob_free(&names_blob); + data_blob_free(&server_chal); + DEBUG(0, ("winbindd_pam_auth: SMBNTLMv2encrypt() failed!\n")); + result = NT_STATUS_NO_MEMORY; + goto done; + } + data_blob_free(&names_blob); + data_blob_free(&server_chal); + lm_resp = data_blob_talloc(mem_ctx, lm_response.data, lm_response.length); + nt_resp = data_blob_talloc(mem_ctx, nt_response.data, nt_response.length); + data_blob_free(&lm_response); + data_blob_free(&nt_response); + + } else { + if (lp_client_lanman_auth() + && SMBencrypt(state->request.data.auth.pass, + chal, + local_lm_response)) { + lm_resp = data_blob_talloc(mem_ctx, + local_lm_response, + sizeof(local_lm_response)); + } else { + lm_resp = data_blob(NULL, 0); + } + SMBNTencrypt(state->request.data.auth.pass, + chal, + local_nt_response); + + nt_resp = data_blob_talloc(mem_ctx, + local_nt_response, + sizeof(local_nt_response)); + } - lm_resp = data_blob_talloc(mem_ctx, local_lm_response, sizeof(local_lm_response)); - nt_resp = data_blob_talloc(mem_ctx, local_nt_response, sizeof(local_nt_response)); /* what domain should we contact? */ @@ -288,10 +334,10 @@ enum winbindd_result winbindd_pam_auth(struct winbindd_cli_state *state) /* Check if the user is in the right group */ - if (!NT_STATUS_IS_OK(result = check_info3_in_group(mem_ctx, &info3, state->request.data.auth.required_membership_sid))) { + if (!NT_STATUS_IS_OK(result = check_info3_in_group(mem_ctx, &info3, state->request.data.auth.require_membership_of_sid))) { DEBUG(3, ("User %s is not in the required group (%s), so plaintext authentication is rejected\n", state->request.data.auth.user, - state->request.data.auth.required_membership_sid)); + state->request.data.auth.require_membership_of_sid)); } } @@ -368,7 +414,7 @@ enum winbindd_result winbindd_pam_auth_crap(struct winbindd_cli_state *state) NET_USER_INFO_3 info3; struct cli_state *cli = NULL; TALLOC_CTX *mem_ctx = NULL; - char *name_user = NULL; + const char *name_user = NULL; const char *name_domain = NULL; const char *workstation; struct winbindd_domain *contact_domain; @@ -386,7 +432,7 @@ enum winbindd_result winbindd_pam_auth_crap(struct winbindd_cli_state *state) /* send a better message than ACCESS_DENIED */ asprintf(&error_string, "winbind client not authorized to use winbindd_pam_auth_crap. Ensure permissions on %s are set correctly.", get_winbind_priv_pipe_dir()); - push_utf8_fstring(state->response.data.auth.error_string, error_string); + fstrcpy(state->response.data.auth.error_string, error_string); SAFE_FREE(error_string); result = NT_STATUS_ACCESS_DENIED; goto done; @@ -396,26 +442,16 @@ enum winbindd_result winbindd_pam_auth_crap(struct winbindd_cli_state *state) state->request.data.auth_crap.user[sizeof(state->request.data.auth_crap.user)-1]=0; state->request.data.auth_crap.domain[sizeof(state->request.data.auth_crap.domain)-1]=0; - if (!(mem_ctx = talloc_init("winbind pam auth crap for (utf8) %s", state->request.data.auth_crap.user))) { + if (!(mem_ctx = talloc_init("winbind pam auth crap for %s", state->request.data.auth_crap.user))) { DEBUG(0, ("winbindd_pam_auth_crap: could not talloc_init()!\n")); result = NT_STATUS_NO_MEMORY; goto done; } - if (pull_utf8_talloc(mem_ctx, &name_user, state->request.data.auth_crap.user) == (size_t)-1) { - DEBUG(0, ("winbindd_pam_auth_crap: pull_utf8_talloc failed!\n")); - result = NT_STATUS_UNSUCCESSFUL; - goto done; - } + name_user = state->request.data.auth_crap.user; if (*state->request.data.auth_crap.domain) { - char *dom = NULL; - if (pull_utf8_talloc(mem_ctx, &dom, state->request.data.auth_crap.domain) == (size_t)-1) { - DEBUG(0, ("winbindd_pam_auth_crap: pull_utf8_talloc failed!\n")); - result = NT_STATUS_UNSUCCESSFUL; - goto done; - } - name_domain = dom; + name_domain = state->request.data.auth_crap.domain; } else if (lp_winbind_use_default_domain()) { name_domain = lp_workgroup(); } else { @@ -429,13 +465,7 @@ enum winbindd_result winbindd_pam_auth_crap(struct winbindd_cli_state *state) name_domain, name_user)); if (*state->request.data.auth_crap.workstation) { - char *wrk = NULL; - if (pull_utf8_talloc(mem_ctx, &wrk, state->request.data.auth_crap.workstation) == (size_t)-1) { - DEBUG(0, ("winbindd_pam_auth_crap: pull_utf8_talloc failed!\n")); - result = NT_STATUS_UNSUCCESSFUL; - goto done; - } - workstation = wrk; + workstation = state->request.data.auth_crap.workstation; } else { workstation = global_myname(); } @@ -541,10 +571,10 @@ enum winbindd_result winbindd_pam_auth_crap(struct winbindd_cli_state *state) netsamlogon_cache_store( cli->mem_ctx, name_user, &info3 ); wcache_invalidate_samlogon(find_domain_from_name(name_domain), &info3); - if (!NT_STATUS_IS_OK(result = check_info3_in_group(mem_ctx, &info3, state->request.data.auth_crap.required_membership_sid))) { + if (!NT_STATUS_IS_OK(result = check_info3_in_group(mem_ctx, &info3, state->request.data.auth_crap.require_membership_of_sid))) { DEBUG(3, ("User %s is not in the required group (%s), so plaintext authentication is rejected\n", state->request.data.auth_crap.user, - state->request.data.auth_crap.required_membership_sid)); + state->request.data.auth_crap.require_membership_of_sid)); goto done; } @@ -570,8 +600,8 @@ enum winbindd_result winbindd_pam_auth_crap(struct winbindd_cli_state *state) DEBUG(5, ("Setting unix username to [%s]\n", username_out)); - /* this interface is in UTF8 */ - if (push_utf8_allocate((char **)&state->response.extra_data, username_out) == -1) { + state->response.extra_data = strdup(username_out); + if (!state->response.extra_data) { result = NT_STATUS_NO_MEMORY; goto done; } @@ -597,11 +627,11 @@ done: } state->response.data.auth.nt_status = NT_STATUS_V(result); - push_utf8_fstring(state->response.data.auth.nt_status_string, nt_errstr(result)); + fstrcpy(state->response.data.auth.nt_status_string, nt_errstr(result)); /* we might have given a more useful error above */ if (!*state->response.data.auth.error_string) - push_utf8_fstring(state->response.data.auth.error_string, get_friendly_nt_error_msg(result)); + fstrcpy(state->response.data.auth.error_string, get_friendly_nt_error_msg(result)); state->response.data.auth.pam_error = nt_status_to_pam(result); DEBUG(NT_STATUS_IS_OK(result) ? 5 : 2, @@ -631,7 +661,7 @@ enum winbindd_result winbindd_pam_chauthtok(struct winbindd_cli_state *state) DEBUG(3, ("[%5lu]: pam chauthtok %s\n", (unsigned long)state->pid, state->request.data.chauthtok.user)); - if (!(mem_ctx = talloc_init("winbind password change for (utf8) %s", + if (!(mem_ctx = talloc_init("winbind password change for %s", state->request.data.chauthtok.user))) { DEBUG(0, ("winbindd_pam_auth_crap: could not talloc_init()!\n")); result = NT_STATUS_NO_MEMORY; diff --git a/source/nsswitch/winbindd_sid.c b/source/nsswitch/winbindd_sid.c index 97e676813dd..060e66fbc2d 100644 --- a/source/nsswitch/winbindd_sid.c +++ b/source/nsswitch/winbindd_sid.c @@ -219,7 +219,7 @@ enum winbindd_result winbindd_sid_to_uid(struct winbindd_cli_state *state) if (NT_STATUS_IS_OK(result)) return WINBINDD_OK; - DEBUG(1, ("Could not get uid for sid %s\n", state->request.data.sid)); + DEBUG(4, ("Could not get uid for sid %s\n", state->request.data.sid)); return WINBINDD_ERROR; } @@ -337,7 +337,7 @@ enum winbindd_result winbindd_sid_to_gid(struct winbindd_cli_state *state) if (NT_STATUS_IS_OK(result)) return WINBINDD_OK; - DEBUG(1, ("Could not get gid for sid %s\n", state->request.data.sid)); + DEBUG(4, ("Could not get gid for sid %s\n", state->request.data.sid)); return WINBINDD_ERROR; } diff --git a/source/nsswitch/winbindd_util.c b/source/nsswitch/winbindd_util.c index 66006905385..a96f652c617 100644 --- a/source/nsswitch/winbindd_util.c +++ b/source/nsswitch/winbindd_util.c @@ -641,14 +641,15 @@ BOOL parse_domain_user(const char *domuser, fstring domain, fstring user) */ void fill_domain_username(fstring name, const char *domain, const char *user) { + strlower_m( name ); + if (assume_domain(domain)) { strlcpy(name, user, sizeof(fstring)); } else { - slprintf(name, sizeof(fstring) - 1, "%s%s%s", - domain, lp_winbind_separator(), + slprintf(name, sizeof(fstring) - 1, "%s%c%s", + domain, *lp_winbind_separator(), user); } - strlower_m(name); } /* diff --git a/source/param/loadparm.c b/source/param/loadparm.c index 24811af37dd..053626c730f 100644 --- a/source/param/loadparm.c +++ b/source/param/loadparm.c @@ -413,6 +413,7 @@ typedef struct BOOL bMSDfsRoot; BOOL bUseClientDriver; BOOL bDefaultDevmode; + BOOL bForcePrintername; BOOL bNTAclSupport; BOOL bForceUnknownAclUser; BOOL bUseSendfile; @@ -537,6 +538,7 @@ static service sDefault = { False, /* bMSDfsRoot */ False, /* bUseClientDriver */ False, /* bDefaultDevmode */ + False, /* bForcePrintername */ True, /* bNTAclSupport */ False, /* bForceUnknownAclUser */ True, /* bUseSendfile */ @@ -983,6 +985,7 @@ static struct parm_struct parm_table[] = { {"printer", P_STRING, P_LOCAL, &sDefault.szPrintername, NULL, NULL, FLAG_HIDE}, {"use client driver", P_BOOL, P_LOCAL, &sDefault.bUseClientDriver, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT}, {"default devmode", P_BOOL, P_LOCAL, &sDefault.bDefaultDevmode, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT}, + {"force printername", P_BOOL, P_LOCAL, &sDefault.bForcePrintername, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT}, {N_("Filename Handling"), P_SEP, P_SEPARATOR}, {"mangling method", P_STRING, P_GLOBAL, &Globals.szManglingMethod, NULL, NULL, FLAG_ADVANCED}, @@ -1885,6 +1888,7 @@ FN_LOCAL_BOOL(lp_inherit_perms, bInheritPerms) FN_LOCAL_BOOL(lp_inherit_acls, bInheritACLS) FN_LOCAL_BOOL(lp_use_client_driver, bUseClientDriver) FN_LOCAL_BOOL(lp_default_devmode, bDefaultDevmode) +FN_LOCAL_BOOL(lp_force_printername, bForcePrintername) FN_LOCAL_BOOL(lp_nt_acl_support, bNTAclSupport) FN_LOCAL_BOOL(lp_force_unknown_acl_user, bForceUnknownAclUser) FN_LOCAL_BOOL(lp_ea_support, bEASupport) @@ -4267,28 +4271,6 @@ void lp_set_logfile(const char *name) } /******************************************************************* - Return the NetBIOS called name, or my IP - but never global_myname(). -********************************************************************/ - -const char *get_called_name(void) -{ - extern fstring local_machine; - static fstring called_name; - - if ( (!*local_machine) || - (client_socket_port() == 445) ) { - /* Everybody coming in on 445 should be able to live with the - * IP address */ - fstrcpy(called_name, client_socket_addr()); - DEBUG(8,("get_called_name: assuming that client used IP address [%s] as called name.\n", - called_name)); - return called_name; - } - - return local_machine; -} - -/******************************************************************* Return the max print jobs per queue. ********************************************************************/ diff --git a/source/passdb/pdb_ldap.c b/source/passdb/pdb_ldap.c index 454aa8d8702..f7ee8dcb42d 100644 --- a/source/passdb/pdb_ldap.c +++ b/source/passdb/pdb_ldap.c @@ -161,7 +161,7 @@ static char** get_userattr_delete_list( int schema_ver ) case SCHEMAVER_SAMBASAMACCOUNT: return get_attr_list( attrib_map_to_delete_v30 ); default: - DEBUG(0,("get_userattr_list: unknown schema version specified!\n")); + DEBUG(0,("get_userattr_delete_list: unknown schema version specified!\n")); break; } @@ -727,6 +727,9 @@ static BOOL init_sam_from_ldap (struct ldapsam_privates *ldap_state, uint8 *pwhist = NULL; int i; + /* We can only store (sizeof(pstring)-1)/64 password history entries. */ + pwHistLen = MIN(pwHistLen, ((sizeof(temp)-1)/64)); + if ((pwhist = malloc(pwHistLen * PW_HISTORY_ENTRY_LEN)) == NULL){ DEBUG(0, ("init_sam_from_ldap: malloc failed!\n")); return False; @@ -1393,7 +1396,7 @@ static NTSTATUS ldapsam_getsampwsid(struct pdb_methods *my_methods, SAM_ACCOUNT } if (!init_sam_from_ldap(ldap_state, user, entry)) { - DEBUG(1,("ldapsam_getsampwrid: init_sam_from_ldap failed!\n")); + DEBUG(1,("ldapsam_getsampwsid: init_sam_from_ldap failed!\n")); ldap_msgfree(result); return NT_STATUS_NO_SUCH_USER; } @@ -1404,6 +1407,66 @@ static NTSTATUS ldapsam_getsampwsid(struct pdb_methods *my_methods, SAM_ACCOUNT return NT_STATUS_OK; } +static BOOL ldapsam_can_pwchange_exop(struct smbldap_state *ldap_state) +{ + LDAPMessage *msg = NULL; + LDAPMessage *entry = NULL; + char **values = NULL; + char *attrs[] = { "supportedExtension", NULL }; + int rc, num_result, num_values, i; + BOOL result = False; + + rc = smbldap_search(ldap_state, "", LDAP_SCOPE_BASE, "(objectclass=*)", + attrs, 0, &msg); + + if (rc != LDAP_SUCCESS) { + DEBUG(3, ("Could not search rootDSE\n")); + return False; + } + + num_result = ldap_count_entries(ldap_state->ldap_struct, msg); + + if (num_result != 1) { + DEBUG(3, ("Expected one rootDSE, got %d\n", num_result)); + goto done; + } + + entry = ldap_first_entry(ldap_state->ldap_struct, msg); + + if (entry == NULL) { + DEBUG(3, ("Could not retrieve rootDSE\n")); + goto done; + } + + values = ldap_get_values(ldap_state->ldap_struct, entry, + "supportedExtension"); + + if (values == NULL) { + DEBUG(9, ("LDAP Server does not support any extensions\n")); + goto done; + } + + num_values = ldap_count_values(values); + + if (num_values == 0) { + DEBUG(9, ("LDAP Server does not support any extensions\n")); + goto done; + } + + for (i=0; i<num_values; i++) { + if (strcmp(values[i], LDAP_EXOP_MODIFY_PASSWD) == 0) + result = True; + } + + done: + if (values != NULL) + ldap_value_free(values); + if (msg != NULL) + ldap_msgfree(msg); + + return result; +} + /******************************************************************** Do the actual modification - also change a plaintext passord if it it set. @@ -1467,6 +1530,12 @@ static NTSTATUS ldapsam_modify_entry(struct pdb_methods *my_methods, char *utf8_password; char *utf8_dn; + if (!ldapsam_can_pwchange_exop(ldap_state->smbldap_state)) { + DEBUG(2, ("ldap password change requested, but LDAP " + "server does not support it -- ignoring\n")); + return NT_STATUS_OK; + } + if (push_utf8_allocate(&utf8_password, pdb_get_plaintext_passwd(newpwd)) == (size_t)-1) { return NT_STATUS_NO_MEMORY; } @@ -1503,6 +1572,15 @@ static NTSTATUS ldapsam_modify_entry(struct pdb_methods *my_methods, bv, NULL, NULL, &retoid, &retdata)) != LDAP_SUCCESS) { char *ld_error = NULL; + + if (rc == LDAP_OBJECT_CLASS_VIOLATION) { + DEBUG(3, ("Could not set userPassword " + "attribute due to an objectClass " + "violation -- ignoring\n")); + ber_bvfree(bv); + return NT_STATUS_OK; + } + ldap_get_option(ldap_state->smbldap_state->ldap_struct, LDAP_OPT_ERROR_STRING, &ld_error); DEBUG(0,("ldapsam_modify_entry: LDAP Password could not be changed for user %s: %s\n\t%s\n", @@ -2384,7 +2462,7 @@ static NTSTATUS ldapsam_setsamgrent(struct pdb_methods *my_methods, BOOL update) return NT_STATUS_UNSUCCESSFUL; } - DEBUG(2, ("ldapsam_setsampwent: %d entries in the base!\n", + DEBUG(2, ("ldapsam_setsamgrent: %d entries in the base!\n", ldap_count_entries(ldap_state->smbldap_state->ldap_struct, ldap_state->result))); @@ -2508,13 +2586,13 @@ static NTSTATUS ldapsam_modify_aliasmem(struct pdb_methods *methods, result); if (count < 1) { - DEBUG(4, ("ldapsam_add_aliasmem: Did not find alias\n")); + DEBUG(4, ("ldapsam_modify_aliasmem: Did not find alias\n")); ldap_msgfree(result); return NT_STATUS_NO_SUCH_ALIAS; } if (count > 1) { - DEBUG(1, ("ldapsam_getgroup: Duplicate entries for filter %s: " + DEBUG(1, ("ldapsam_modify_aliasmem: Duplicate entries for filter %s: " "count=%d\n", filter, count)); ldap_msgfree(result); return NT_STATUS_NO_SUCH_ALIAS; @@ -2549,7 +2627,7 @@ static NTSTATUS ldapsam_modify_aliasmem(struct pdb_methods *methods, ldap_get_option(ldap_state->smbldap_state->ldap_struct, LDAP_OPT_ERROR_STRING,&ld_error); - DEBUG(0, ("ldapsam_delete_entry: Could not delete attributes " + DEBUG(0, ("ldapsam_modify_aliasmem: Could not modify alias " "for %s, error: %s (%s)\n", dn, ldap_err2string(rc), ld_error?ld_error:"unknown")); SAFE_FREE(ld_error); @@ -2607,13 +2685,13 @@ static NTSTATUS ldapsam_enum_aliasmem(struct pdb_methods *methods, result); if (count < 1) { - DEBUG(4, ("ldapsam_add_aliasmem: Did not find alias\n")); + DEBUG(4, ("ldapsam_enum_aliasmem: Did not find alias\n")); ldap_msgfree(result); return NT_STATUS_NO_SUCH_ALIAS; } if (count > 1) { - DEBUG(1, ("ldapsam_getgroup: Duplicate entries for filter %s: " + DEBUG(1, ("ldapsam_enum_aliasmem: Duplicate entries for filter %s: " "count=%d\n", filter, count)); ldap_msgfree(result); return NT_STATUS_NO_SUCH_ALIAS; @@ -2918,7 +2996,7 @@ and will risk BDCs having inconsistant SIDs\n")); } if (smbldap_get_single_pstring(ldap_state->smbldap_state->ldap_struct, entry, - get_userattr_key2string(ldap_state->schema_ver, LDAP_ATTR_ALGORITHMIC_RID_BASE), + get_attr_key2string( dominfo_attr_list, LDAP_ATTR_ALGORITHMIC_RID_BASE ), alg_rid_base_string)) { alg_rid_base = (uint32)atol(alg_rid_base_string); if (alg_rid_base != algorithmic_rid_base()) { diff --git a/source/po/de.msg b/source/po/de.msg index b1b84a21b67..b62a17d150f 100644 --- a/source/po/de.msg +++ b/source/po/de.msg @@ -23,13 +23,13 @@ msgstr "" "Last-Translator: Andreas Moroder\n" "Language-Team: (Samba Team) <samba-technical@samba.org>\n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=iso-8859-1\n" +"Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" #: ../web/swat.c:117 #, c-format msgid "ERROR: Can't open %s" -msgstr "ERRORE: Kann %s nicht ffnen" +msgstr "ERRORE: Kann %s nicht テカffnen" #: ../web/swat.c:200 msgid "Help" @@ -100,7 +100,7 @@ msgstr "Erweiterte Ansicht" #: ../web/swat.c:529 msgid "Change View To" -msgstr "トndere Passwort" +msgstr "テndere Passwort" #: ../web/swat.c:554 msgid "Current Config" @@ -108,7 +108,7 @@ msgstr "Aktuelle Konfiguration" #: ../web/swat.c:558 msgid "Normal View" -msgstr "Normale Ansich" +msgstr "Normale Ansicht" #: ../web/swat.c:560 msgid "Full View" @@ -159,11 +159,11 @@ msgstr "" #: ../web/swat.c:734 msgid "Domain Member" -msgstr "Dom舅en master" +msgstr "Domテ、nen master" #: ../web/swat.c:735 msgid "Domain Controller" -msgstr "Dom舅en master" +msgstr "Domテ、nen master" #: ../web/swat.c:738 msgid "Unusual Type in smb.conf - Please Select New Mode" @@ -211,11 +211,11 @@ msgstr "Globale Variablen" #: ../web/swat.c:815 ../web/swat.c:916 ../web/swat.c:1265 msgid "Commit Changes" -msgstr "Speichere トnderungen" +msgstr "Speichere テnderungen" #: ../web/swat.c:819 ../web/swat.c:919 ../web/swat.c:1267 msgid "Reset Values" -msgstr "Setze Werte zurck" +msgstr "Setze Werte zurテシck" #: ../web/swat.c:844 msgid "Share Parameters" @@ -223,11 +223,11 @@ msgstr "Parameter der Freigabe" #: ../web/swat.c:887 msgid "Choose Share" -msgstr "W臧le Freigabe" +msgstr "Wテ、hle Freigabe" #: ../web/swat.c:901 msgid "Delete Share" -msgstr "Lsche Freigabe" +msgstr "Lテカsche Freigabe" #: ../web/swat.c:908 msgid "Create Share" @@ -235,7 +235,7 @@ msgstr "Erstelle Freigabe" #: ../web/swat.c:944 msgid "password change in demo mode rejected" -msgstr "トnderung des Passworts im Demo modus nicht aktiv" +msgstr "テnderung des Passworts im Demo modus nicht aktiv" #: ../web/swat.c:957 msgid "Can't setup password database vectors." @@ -247,29 +247,29 @@ msgstr " \"Benutzername\" muss angegeben werden " #: ../web/swat.c:999 msgid " Must specify \"Old Password\" " -msgstr " \"Altes Passwort\" mu゚ angegeben werden " +msgstr " \"Altes Passwort\" muテ angegeben werden " #: ../web/swat.c:1005 msgid " Must specify \"Remote Machine\" " -msgstr " \"Remote Maschine\" mu゚ angegeben werden " +msgstr " \"Remote Maschine\" muテ angegeben werden " #: ../web/swat.c:1012 msgid " Must specify \"New, and Re-typed Passwords\" " -msgstr " \"Neues/Best舩ige Passwort\" mu゚ angegeben werden " +msgstr " \"Neues/Bestテ、tige Passwort\" muテ angegeben werden " #: ../web/swat.c:1018 msgid " Re-typed password didn't match new password " -msgstr " Das best舩igte Passwort stimmt nicht mit dem neuen Passwort berein" +msgstr " Das bestテ、tigte Passwort stimmt nicht mit dem neuen Passwort テシberein" #: ../web/swat.c:1048 #, c-format msgid " The passwd for '%s' has been changed." -msgstr " Das Passwort fr '%s' wurde ge舅dert." +msgstr " Das Passwort fテシr '%s' wurde geテ、ndert." #: ../web/swat.c:1051 #, c-format msgid " The passwd for '%s' has NOT been changed." -msgstr " Das Passwort fr '%s' wurde nicht ge舅dert." +msgstr " Das Passwort fテシr '%s' wurde nicht geテ、ndert." #: ../web/swat.c:1076 msgid "Server Password Management" @@ -292,23 +292,23 @@ msgstr "Neues Passwort" #: ../web/swat.c:1093 ../web/swat.c:1138 msgid "Re-type New Password" -msgstr "Best舩ige neues Passwort" +msgstr "Bestテ、tige neues Passwort" #: ../web/swat.c:1101 ../web/swat.c:1149 msgid "Change Password" -msgstr "トndere Passwort" +msgstr "テndere Passwort" #: ../web/swat.c:1104 msgid "Add New User" -msgstr "Fge Benutzer hinzu" +msgstr "Fテシge Benutzer hinzu" #: ../web/swat.c:1106 msgid "Delete User" -msgstr "Lsche Benutzer" +msgstr "Lテカsche Benutzer" #: ../web/swat.c:1108 msgid "Disable User" -msgstr "Desaktiviere Benutzer" +msgstr "Deaktiviere Benutzer" #: ../web/swat.c:1110 msgid "Enable User" @@ -344,15 +344,15 @@ msgstr "Printcap Name" #: ../web/swat.c:1185 msgid "Attempting to delete these printers from SWAT will have no effect." -msgstr "Der Versuch diese Drucker von SWAT aus zu lschen wird keine Auswirkung haben." +msgstr "Der Versuch diese Drucker von SWAT aus zu lテカschen wird keine Auswirkung haben." #: ../web/swat.c:1231 msgid "Choose Printer" -msgstr "W臧le Drucker" +msgstr "Wテ、hle Drucker" #: ../web/swat.c:1250 msgid "Delete Printer" -msgstr "Lsche Drucker" +msgstr "Lテカsche Drucker" #: ../web/swat.c:1257 msgid "Create Printer" @@ -558,7 +558,7 @@ msgstr "Verwaltung Dateinamen" #: ../param/loadparm.c:996 msgid "Domain Options" -msgstr "Dom舅en Optionen" +msgstr "Domテ、nen Optionen" #: ../param/loadparm.c:1000 msgid "Logon Options" diff --git a/source/po/en.msg b/source/po/en.msg index 6a1fcb55bac..47d156239f4 100644 --- a/source/po/en.msg +++ b/source/po/en.msg @@ -23,7 +23,7 @@ msgstr "" "Last-Translator: TAKAHASHI Motonobu <monyo@samba.org>\n" "Language-Team: (Samba Team) <samba-technical@samba.org>\n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=US-ASCII\n" +"Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: \n" #: ../web/swat.c:117 diff --git a/source/po/fr.msg b/source/po/fr.msg index 134f1d6390b..8de5de71500 100644 --- a/source/po/fr.msg +++ b/source/po/fr.msg @@ -1,5 +1,5 @@ # French messages for international release of SWAT. -# Copyright (C) 2001 Fran輟is Le Lay <fanch@tuxfamily.org> +# Copyright (C) 2001 Franテァois Le Lay <fanch@tuxfamily.org> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -20,10 +20,10 @@ msgstr "" "Project-Id-Version: i18n_swat \n" "POT-Creation-Date: 2003-10-06 05:30+0900\n" "PO-Revision-Date: 2000-02-08 14:45+0100\n" -"Last-Translator: Fran輟is Le Lay <fanch@tuxfamily.org>\n" +"Last-Translator: Franテァois Le Lay <fanch@tuxfamily.org>\n" "Language-Team: (Samba Team) <samba-technical@samba.org>\n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=iso-8859-1\n" +"Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: \n" #: ../web/swat.c:117 @@ -37,7 +37,7 @@ msgstr "Aide" #: ../web/swat.c:206 ../web/swat.c:220 ../web/swat.c:235 ../web/swat.c:243 ../web/swat.c:252 ../web/swat.c:261 ../web/swat.c:267 ../web/swat.c:273 ../web/swat.c:286 msgid "Set Default" -msgstr "D馭inir par d馭aut" +msgstr "Dテゥfinir par dテゥfaut" #: ../web/swat.c:408 #, c-format @@ -52,7 +52,7 @@ msgstr "" #: ../web/swat.c:501 #, c-format msgid "Logged in as <b>%s</b>" -msgstr "Connect en tant que <b>%s</b>" +msgstr "Connectテゥ en tant que <b>%s</b>" #: ../web/swat.c:505 msgid "Home" @@ -60,7 +60,7 @@ msgstr "Home" #: ../web/swat.c:507 msgid "Globals" -msgstr "Param鑼res G駭駻aux" +msgstr "Paramティtres Gテゥnテゥraux" #: ../web/swat.c:508 msgid "Shares" @@ -96,7 +96,7 @@ msgstr "Vue Basique" #: ../web/swat.c:528 ../web/swat.c:531 msgid "Advanced" -msgstr "Vue D騁aill馥" +msgstr "Vue Dテゥtaillテゥe" #: ../web/swat.c:529 msgid "Change View To" @@ -112,7 +112,7 @@ msgstr "Vue Normale" #: ../web/swat.c:560 msgid "Full View" -msgstr "Vue Compl鑼e" +msgstr "Vue Complティte" #. Here we first set and commit all the parameters that were selected #. in the previous screen. @@ -147,7 +147,7 @@ msgstr "commentaire" #: ../web/swat.c:726 msgid "Edit Parameter Values" -msgstr "Param鑼res Imprimantes" +msgstr "Paramティtres Imprimantes" #: ../web/swat.c:732 msgid "Server Type" @@ -215,11 +215,11 @@ msgstr "Sauver les modifications" #: ../web/swat.c:819 ../web/swat.c:919 ../web/swat.c:1267 msgid "Reset Values" -msgstr "R駟nitialiser Valeurs" +msgstr "Rテゥinitialiser Valeurs" #: ../web/swat.c:844 msgid "Share Parameters" -msgstr "Param鑼res de partage" +msgstr "Paramティtres de partage" #: ../web/swat.c:887 msgid "Choose Share" @@ -231,11 +231,11 @@ msgstr "Supprimer un partage" #: ../web/swat.c:908 msgid "Create Share" -msgstr "Cr馥r un partage" +msgstr "Crテゥer un partage" #: ../web/swat.c:944 msgid "password change in demo mode rejected" -msgstr "changement de mot de passe en mode d駑o rejet" +msgstr "changement de mot de passe en mode dテゥmo rejetテゥ" #: ../web/swat.c:957 msgid "Can't setup password database vectors." @@ -243,19 +243,19 @@ msgstr "" #: ../web/swat.c:983 msgid " Must specify \"User Name\" " -msgstr " Le champ \"Nom d'utilisateur\" doit 黎re sp馗ifi" +msgstr " Le champ \"Nom d'utilisateur\" doit テェtre spテゥcifiテゥ" #: ../web/swat.c:999 msgid " Must specify \"Old Password\" " -msgstr " Le champ \"Ancien mot de passe\" dot 黎re sp馗ifi" +msgstr " Le champ \"Ancien mot de passe\" doテョt テェtre spテゥcifiテゥ" #: ../web/swat.c:1005 msgid " Must specify \"Remote Machine\" " -msgstr " Le champ \"Machine Distante\" dot 黎re sp馗ifi" +msgstr " Le champ \"Machine Distante\" doテョt テェtre spテゥcifiテゥ" #: ../web/swat.c:1012 msgid " Must specify \"New, and Re-typed Passwords\" " -msgstr "Les champs \"Nouveau mot de passe\" et \"Confirmation du nouveau mot de passe\" doivent 黎re sp馗ifi駸 \n" +msgstr "Les champs \"Nouveau mot de passe\" et \"Confirmation du nouveau mot de passe\" doivent テェtre spテゥcifiテゥs \n" #: ../web/swat.c:1018 msgid " Re-typed password didn't match new password " @@ -264,12 +264,12 @@ msgstr " Echec de la confirmation du nouveau mot de passe" #: ../web/swat.c:1048 #, c-format msgid " The passwd for '%s' has been changed." -msgstr " Le mot de passe de '%s' a 騁 modifi. " +msgstr " Le mot de passe de '%s' a テゥtテゥ modifiテゥ. " #: ../web/swat.c:1051 #, c-format msgid " The passwd for '%s' has NOT been changed." -msgstr " Le mot de passe de '%s' n'a PAS 騁 modifi. \n" +msgstr " Le mot de passe de '%s' n'a PAS テゥtテゥ modifiテゥ. \n" #: ../web/swat.c:1076 msgid "Server Password Management" @@ -308,7 +308,7 @@ msgstr "Supprimer Utilisateur" #: ../web/swat.c:1108 msgid "Disable User" -msgstr "D駸activer Utilisateur" +msgstr "Dテゥsactiver Utilisateur" #: ../web/swat.c:1110 msgid "Enable User" @@ -324,7 +324,7 @@ msgstr " Machine distante : " #: ../web/swat.c:1179 msgid "Printer Parameters" -msgstr "Param鑼res Imprimantes" +msgstr "Paramティtres Imprimantes" #: ../web/swat.c:1181 msgid "Important Note:" @@ -332,11 +332,11 @@ msgstr "Note Importante:" #: ../web/swat.c:1182 msgid "Printer names marked with [*] in the Choose Printer drop-down box " -msgstr "Les Noms d'imprimantes marqu駸 du signe [*] dans le menu d駻oulant Choisir Imprimante" +msgstr "Les Noms d'imprimantes marquテゥs du signe [*] dans le menu dテゥroulant Choisir Imprimante" #: ../web/swat.c:1183 msgid "are autoloaded printers from " -msgstr "d駸ignent des imprimantes automatiquement charg馥s depuis le " +msgstr "dテゥsignent des imprimantes automatiquement chargテゥes depuis le " #: ../web/swat.c:1184 msgid "Printcap Name" @@ -356,7 +356,7 @@ msgstr "Supprimer Imprimante" #: ../web/swat.c:1257 msgid "Create Printer" -msgstr "Cr馥r Imprimante" +msgstr "Crテゥer Imprimante" #: ../web/statuspage.c:123 msgid "RDONLY " @@ -376,15 +376,15 @@ msgstr "Statut du Serveur" #: ../web/statuspage.c:314 msgid "Auto Refresh" -msgstr "Rafrachissement Automatique" +msgstr "Rafraテョchissement Automatique" #: ../web/statuspage.c:315 ../web/statuspage.c:320 msgid "Refresh Interval: " -msgstr "Intervalle de rafrachissement: " +msgstr "Intervalle de rafraテョchissement: " #: ../web/statuspage.c:319 msgid "Stop Refreshing" -msgstr "Stopper Rafrachissement" +msgstr "Stopper Rafraテョchissement" #: ../web/statuspage.c:334 msgid "version:" @@ -534,7 +534,7 @@ msgstr "Options de base" #: ../param/loadparm.c:775 msgid "Security Options" -msgstr "Options de S馗urit" +msgstr "Options de Sテゥcuritテゥ" #: ../param/loadparm.c:859 msgid "Logging Options" @@ -546,7 +546,7 @@ msgstr "Options de Protocole" #: ../param/loadparm.c:911 msgid "Tuning Options" -msgstr "Options de r馮lage" +msgstr "Options de rテゥglage" #: ../param/loadparm.c:940 msgid "Printing Options" diff --git a/source/po/it.msg b/source/po/it.msg index be447a84d47..c52ee65b85d 100644 --- a/source/po/it.msg +++ b/source/po/it.msg @@ -23,7 +23,7 @@ msgstr "" "Last-Translator: Simo Sorce <idra@samba.org>\n" "Language-Team: (Samba Team) <samba-technical@samba.org>\n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=iso-8859-1\n" +"Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: \n" #: ../web/swat.c:117 diff --git a/source/po/ja.msg b/source/po/ja.msg index affb2764141..206351b6172 100644 --- a/source/po/ja.msg +++ b/source/po/ja.msg @@ -24,152 +24,152 @@ msgstr "" "Last-Translator: TAKAHASHI Motonobu <monyo@samba.org>\n" "Language-Team: Samba Users Group Japan <sugj-tech@samba.gr.jp>\n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=CP932\n" +"Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: ../web/swat.c:117 #, c-format msgid "ERROR: Can't open %s" -msgstr "%s をオープンできません" +msgstr "%s 繧偵が繝シ繝励Φ縺ァ縺阪∪縺帙s" #: ../web/swat.c:200 msgid "Help" -msgstr "ヘルプ" +msgstr "繝倥Ν繝" #: ../web/swat.c:206 ../web/swat.c:220 ../web/swat.c:235 ../web/swat.c:243 ../web/swat.c:252 ../web/swat.c:261 ../web/swat.c:267 ../web/swat.c:273 ../web/swat.c:286 msgid "Set Default" -msgstr "デフォルト値" +msgstr "繝繝輔か繝ォ繝亥、" #: ../web/swat.c:408 #, c-format msgid "failed to open %s for writing" -msgstr "%s を書き込み用にオープンできません" +msgstr "%s 繧呈嶌縺崎セシ縺ソ逕ィ縺ォ繧ェ繝シ繝励Φ縺ァ縺阪∪縺帙s" #: ../web/swat.c:431 #, c-format msgid "Can't reload %s" -msgstr "%s を再読み込みできません\n" +msgstr "%s 繧貞崎ェュ縺ソ霎シ縺ソ縺ァ縺阪∪縺帙s\n" # msgid "Logged in as <b>%s</b><p>\n" #: ../web/swat.c:501 #, c-format msgid "Logged in as <b>%s</b>" -msgstr "<b>%s</b>としてログイン" +msgstr "<b>%s</b>縺ィ縺励※繝ュ繧ー繧、繝ウ" #: ../web/swat.c:505 msgid "Home" -msgstr "ホーム" +msgstr "繝帙シ繝" #: ../web/swat.c:507 msgid "Globals" -msgstr "グローバル" +msgstr "繧ー繝ュ繝シ繝舌Ν" #: ../web/swat.c:508 msgid "Shares" -msgstr "ファイル共有" +msgstr "繝輔ぃ繧、繝ォ蜈ア譛" #: ../web/swat.c:509 msgid "Printers" -msgstr "印刷共有" +msgstr "蜊ー蛻キ蜈ア譛" #: ../web/swat.c:510 msgid "Wizard" -msgstr "ウィザード" +msgstr "繧ヲ繧」繧カ繝シ繝" #: ../web/swat.c:513 msgid "Status" -msgstr "サーバの状態" +msgstr "繧オ繝シ繝舌ョ迥カ諷" #: ../web/swat.c:514 msgid "View Config" -msgstr "現在の設定" +msgstr "迴セ蝨ィ縺ョ險ュ螳" #: ../web/swat.c:516 msgid "Password Management" -msgstr "パスワード管理" +msgstr "繝代せ繝ッ繝シ繝臥ョ。逅" #: ../web/swat.c:526 msgid "Current View Is" -msgstr "現在の表示モード" +msgstr "迴セ蝨ィ縺ョ陦ィ遉コ繝「繝シ繝" #: ../web/swat.c:527 ../web/swat.c:530 msgid "Basic" -msgstr "標準表示" +msgstr "讓呎コ冶。ィ遉コ" #: ../web/swat.c:528 ../web/swat.c:531 msgid "Advanced" -msgstr "詳細表示" +msgstr "隧ウ邏ー陦ィ遉コ" #: ../web/swat.c:529 msgid "Change View To" -msgstr "表示モードの変更" +msgstr "陦ィ遉コ繝「繝シ繝峨ョ螟画峩" #: ../web/swat.c:554 msgid "Current Config" -msgstr "現在の設定" +msgstr "迴セ蝨ィ縺ョ險ュ螳" #: ../web/swat.c:558 msgid "Normal View" -msgstr "標準表示" +msgstr "讓呎コ冶。ィ遉コ" #: ../web/swat.c:560 msgid "Full View" -msgstr "完全表示" +msgstr "螳悟ィ陦ィ遉コ" #. Here we first set and commit all the parameters that were selected #. in the previous screen. #: ../web/swat.c:579 msgid "Wizard Parameter Edit Page" -msgstr "ウィザードによるパラメータ編集ページ" +msgstr "繧ヲ繧」繧カ繝シ繝峨↓繧医k繝代Λ繝。繝シ繧ソ邱ィ髮繝壹シ繧ク" #: ../web/swat.c:608 msgid "Note: smb.conf file has been read and rewritten" -msgstr "smb.conf ファイルが書き換えられました。" +msgstr "smb.conf 繝輔ぃ繧、繝ォ縺梧嶌縺肴鋤縺医i繧後∪縺励◆縲" #. Here we go ... #: ../web/swat.c:716 msgid "Samba Configuration Wizard" -msgstr "Samba 設定ウィザード" +msgstr "Samba 險ュ螳壹え繧」繧カ繝シ繝" #: ../web/swat.c:720 msgid "The \"Rewrite smb.conf file\" button will clear the smb.conf file of all default values and of comments." -msgstr "「smb.conf の書換」ボタンを押すと smb.conf ファイル中のすべてのデフォルト値やコメントは削除されます。" +msgstr "縲茎mb.conf 縺ョ譖ク謠帙阪懊ち繝ウ繧呈款縺吶→ smb.conf 繝輔ぃ繧、繝ォ荳ュ縺ョ縺吶∋縺ヲ縺ョ繝繝輔か繝ォ繝亥、繧繧ウ繝。繝ウ繝医ッ蜑企勁縺輔l縺セ縺吶" #: ../web/swat.c:721 msgid "The same will happen if you press the commit button." -msgstr "「commit」ボタンを押した場合にも同様の変更が行なわれます。" +msgstr "縲慶ommit縲阪懊ち繝ウ繧呈款縺励◆蝣エ蜷医↓繧ょ酔讒倥ョ螟画峩縺瑚。後↑繧上l縺セ縺吶" #: ../web/swat.c:724 msgid "Rewrite smb.conf file" -msgstr "smb.conf の書換" +msgstr "smb.conf 縺ョ譖ク謠" #: ../web/swat.c:725 msgid "Commit" -msgstr "設定を反映" +msgstr "險ュ螳壹r蜿肴丐" #: ../web/swat.c:726 msgid "Edit Parameter Values" -msgstr "各パラメータの編集" +msgstr "蜷繝代Λ繝。繝シ繧ソ縺ョ邱ィ髮" #: ../web/swat.c:732 msgid "Server Type" -msgstr "サーバタイプ" +msgstr "繧オ繝シ繝舌ち繧、繝" #: ../web/swat.c:733 msgid "Stand Alone" -msgstr "スタンドアロン" +msgstr "繧ケ繧ソ繝ウ繝峨い繝ュ繝ウ" #: ../web/swat.c:734 msgid "Domain Member" -msgstr "ドメインメンバ" +msgstr "繝峨Γ繧、繝ウ繝。繝ウ繝" #: ../web/swat.c:735 msgid "Domain Controller" -msgstr "ドメインコントローラ" +msgstr "繝峨Γ繧、繝ウ繧ウ繝ウ繝医Ο繝シ繝ゥ" #: ../web/swat.c:738 msgid "Unusual Type in smb.conf - Please Select New Mode" -msgstr "通常の形式ではない - 新しいモードを選択のこと" +msgstr "騾壼クク縺ョ蠖「蠑上〒縺ッ縺ェ縺 - 譁ー縺励>繝「繝シ繝峨r驕ク謚槭ョ縺薙→" #: ../web/swat.c:740 msgid "Configure WINS As" @@ -177,220 +177,220 @@ msgstr "WINS" #: ../web/swat.c:741 msgid "Not Used" -msgstr "使わない" +msgstr "菴ソ繧上↑縺" #: ../web/swat.c:742 msgid "Server for client use" -msgstr "サーバとして構成" +msgstr "繧オ繝シ繝舌→縺励※讒区" #: ../web/swat.c:743 msgid "Client of another WINS server" -msgstr "別の WINS サーバのクライアントとして構成" +msgstr "蛻・縺ョ WINS 繧オ繝シ繝舌ョ繧ッ繝ゥ繧、繧「繝ウ繝医→縺励※讒区" #: ../web/swat.c:745 msgid "Remote WINS Server" -msgstr "別の WINS サーバ" +msgstr "蛻・縺ョ WINS 繧オ繝シ繝" #: ../web/swat.c:756 msgid "Error: WINS Server Mode and WINS Support both set in smb.conf" -msgstr "エラー: wins server と wins support の両パラメータが smb.conf で指定されています" +msgstr "繧ィ繝ゥ繝シ: wins server 縺ィ wins support 縺ョ荳。繝代Λ繝。繝シ繧ソ縺 smb.conf 縺ァ謖螳壹&繧後※縺縺セ縺" #: ../web/swat.c:757 msgid "Please Select desired WINS mode above." -msgstr "いずれかの WINS モードを選択してください。" +msgstr "縺縺壹l縺九ョ WINS 繝「繝シ繝峨r驕ク謚槭@縺ヲ縺上□縺輔>縲" #: ../web/swat.c:759 msgid "Expose Home Directories" -msgstr "ホームディレクトリの公開" +msgstr "繝帙シ繝繝繧」繝ャ繧ッ繝医Μ縺ョ蜈ャ髢" #: ../web/swat.c:774 msgid "The above configuration options will set multiple parameters and will generally assist with rapid Samba deployment." -msgstr "上記の設定オプションにより、複数のパラメータが同期して設定されるため、 Samba の運用を迅速に開始する上での助けとなるでしょう。" +msgstr "荳願ィ倥ョ險ュ螳壹が繝励す繝ァ繝ウ縺ォ繧医j縲∬、謨ー縺ョ繝代Λ繝。繝シ繧ソ縺悟酔譛溘@縺ヲ險ュ螳壹&繧後k縺溘a縲 Samba 縺ョ驕狗畑繧定ソ騾溘↓髢句ァ九☆繧倶ク翫〒縺ョ蜉ゥ縺代→縺ェ繧九〒縺励g縺縲" #: ../web/swat.c:787 msgid "Global Parameters" -msgstr "Global パラメータ" +msgstr "Global 繝代Λ繝。繝シ繧ソ" #: ../web/swat.c:815 ../web/swat.c:916 ../web/swat.c:1265 msgid "Commit Changes" -msgstr "変更を反映" +msgstr "螟画峩繧貞渚譏" #: ../web/swat.c:819 ../web/swat.c:919 ../web/swat.c:1267 msgid "Reset Values" -msgstr "変更を取消" +msgstr "螟画峩繧貞叙豸" #: ../web/swat.c:844 msgid "Share Parameters" -msgstr "ファイル共有 パラメータ" +msgstr "繝輔ぃ繧、繝ォ蜈ア譛 繝代Λ繝。繝シ繧ソ" #: ../web/swat.c:887 msgid "Choose Share" -msgstr "ファイル共有の選択" +msgstr "繝輔ぃ繧、繝ォ蜈ア譛峨ョ驕ク謚" #: ../web/swat.c:901 msgid "Delete Share" -msgstr "ファイル共有の削除" +msgstr "繝輔ぃ繧、繝ォ蜈ア譛峨ョ蜑企勁" #: ../web/swat.c:908 msgid "Create Share" -msgstr "ファイル共有の作成" +msgstr "繝輔ぃ繧、繝ォ蜈ア譛峨ョ菴懈" #: ../web/swat.c:944 msgid "password change in demo mode rejected" -msgstr "デモ・モードでのパスワード変更はできません" +msgstr "繝繝「繝サ繝「繝シ繝峨〒縺ョ繝代せ繝ッ繝シ繝牙、画峩縺ッ縺ァ縺阪∪縺帙s" #: ../web/swat.c:957 msgid "Can't setup password database vectors." -msgstr "パスワード・データベースが見つけられません" +msgstr "繝代せ繝ッ繝シ繝峨サ繝繝シ繧ソ繝吶シ繧ケ縺瑚ヲ九▽縺代i繧後∪縺帙s" #: ../web/swat.c:983 msgid " Must specify \"User Name\" " -msgstr "「ユーザ名」欄に入力してください" +msgstr "縲後Θ繝シ繧カ蜷阪肴ャ縺ォ蜈・蜉帙@縺ヲ縺上□縺輔>" #: ../web/swat.c:999 msgid " Must specify \"Old Password\" " -msgstr "「旧パスワード」欄に入力してください" +msgstr "縲梧立繝代せ繝ッ繝シ繝峨肴ャ縺ォ蜈・蜉帙@縺ヲ縺上□縺輔>" #: ../web/swat.c:1005 msgid " Must specify \"Remote Machine\" " -msgstr "「リモートマシン」欄に入力してください" +msgstr "縲後Μ繝「繝シ繝医槭す繝ウ縲肴ャ縺ォ蜈・蜉帙@縺ヲ縺上□縺輔>" #: ../web/swat.c:1012 msgid " Must specify \"New, and Re-typed Passwords\" " -msgstr "「新パスワード」欄と「新パスワードの再入力」欄に入力してください" +msgstr "縲梧眠繝代せ繝ッ繝シ繝峨肴ャ縺ィ縲梧眠繝代せ繝ッ繝シ繝峨ョ蜀榊・蜉帙肴ャ縺ォ蜈・蜉帙@縺ヲ縺上□縺輔>" #: ../web/swat.c:1018 msgid " Re-typed password didn't match new password " -msgstr "「新パスワードの再入力」欄の入力内容が「新パスワード」欄の入力と一致していません。" +msgstr "縲梧眠繝代せ繝ッ繝シ繝峨ョ蜀榊・蜉帙肴ャ縺ョ蜈・蜉帛螳ケ縺後梧眠繝代せ繝ッ繝シ繝峨肴ャ縺ョ蜈・蜉帙→荳閾エ縺励※縺縺セ縺帙s縲" #: ../web/swat.c:1048 #, c-format msgid " The passwd for '%s' has been changed." -msgstr " %s のパスワードは変更されました。" +msgstr " %s 縺ョ繝代せ繝ッ繝シ繝峨ッ螟画峩縺輔l縺セ縺励◆縲" #: ../web/swat.c:1051 #, c-format msgid " The passwd for '%s' has NOT been changed." -msgstr " '%s' のパスワードは変更されませんでした。" +msgstr " '%s' 縺ョ繝代せ繝ッ繝シ繝峨ッ螟画峩縺輔l縺セ縺帙s縺ァ縺励◆縲" #: ../web/swat.c:1076 msgid "Server Password Management" -msgstr "ローカルマシンのパスワード管理" +msgstr "繝ュ繝シ繧ォ繝ォ繝槭す繝ウ縺ョ繝代せ繝ッ繝シ繝臥ョ。逅" #. #. * Create all the dialog boxes for data collection #. #: ../web/swat.c:1085 ../web/swat.c:1132 msgid "User Name" -msgstr "ユーザ名" +msgstr "繝ヲ繝シ繧カ蜷" #: ../web/swat.c:1088 ../web/swat.c:1134 msgid "Old Password" -msgstr "旧パスワード" +msgstr "譌ァ繝代せ繝ッ繝シ繝" #: ../web/swat.c:1091 ../web/swat.c:1136 msgid "New Password" -msgstr "新パスワード" +msgstr "譁ー繝代せ繝ッ繝シ繝" #: ../web/swat.c:1093 ../web/swat.c:1138 msgid "Re-type New Password" -msgstr "新パスワードの再入力" +msgstr "譁ー繝代せ繝ッ繝シ繝峨ョ蜀榊・蜉" #: ../web/swat.c:1101 ../web/swat.c:1149 msgid "Change Password" -msgstr "パスワード変更" +msgstr "繝代せ繝ッ繝シ繝牙、画峩" #: ../web/swat.c:1104 msgid "Add New User" -msgstr "新規ユーザ追加" +msgstr "譁ー隕上Θ繝シ繧カ霑ス蜉" #: ../web/swat.c:1106 msgid "Delete User" -msgstr "ユーザの削除" +msgstr "繝ヲ繝シ繧カ縺ョ蜑企勁" #: ../web/swat.c:1108 msgid "Disable User" -msgstr "ユーザの無効化" +msgstr "繝ヲ繝シ繧カ縺ョ辟。蜉ケ蛹" #: ../web/swat.c:1110 msgid "Enable User" -msgstr "ユーザの有効化" +msgstr "繝ヲ繝シ繧カ縺ョ譛牙柑蛹" #: ../web/swat.c:1123 msgid "Client/Server Password Management" -msgstr "リモートマシンのパスワード管理" +msgstr "繝ェ繝「繝シ繝医槭す繝ウ縺ョ繝代せ繝ッ繝シ繝臥ョ。逅" #: ../web/swat.c:1140 msgid "Remote Machine" -msgstr "リモートマシン" +msgstr "繝ェ繝「繝シ繝医槭す繝ウ" #: ../web/swat.c:1179 msgid "Printer Parameters" -msgstr "印刷共有 パラメータ" +msgstr "蜊ー蛻キ蜈ア譛 繝代Λ繝。繝シ繧ソ" #: ../web/swat.c:1181 msgid "Important Note:" -msgstr "*注" +msgstr "*豕ィ" #: ../web/swat.c:1182 msgid "Printer names marked with [*] in the Choose Printer drop-down box " -msgstr "名前の先頭に [*] がついたプリンタ" +msgstr "蜷榊燕縺ョ蜈磯ュ縺ォ [*] 縺後▽縺縺溘励Μ繝ウ繧ソ" #: ../web/swat.c:1183 msgid "are autoloaded printers from " -msgstr "は" +msgstr "縺ッ" #: ../web/swat.c:1184 msgid "Printcap Name" -msgstr "printcap name パラメータ" +msgstr "printcap name 繝代Λ繝。繝シ繧ソ" #: ../web/swat.c:1185 msgid "Attempting to delete these printers from SWAT will have no effect." -msgstr "から自動設定されたものですから、削除することはできません。" +msgstr "縺九i閾ェ蜍戊ィュ螳壹&繧後◆繧ゅョ縺ァ縺吶°繧峨∝炎髯、縺吶k縺薙→縺ッ縺ァ縺阪∪縺帙s縲" #: ../web/swat.c:1231 msgid "Choose Printer" -msgstr "印刷共有の選択" +msgstr "蜊ー蛻キ蜈ア譛峨ョ驕ク謚" #: ../web/swat.c:1250 msgid "Delete Printer" -msgstr "印刷共有の削除" +msgstr "蜊ー蛻キ蜈ア譛峨ョ蜑企勁" #: ../web/swat.c:1257 msgid "Create Printer" -msgstr "印刷共有の作成" +msgstr "蜊ー蛻キ蜈ア譛峨ョ菴懈" #: ../web/statuspage.c:123 msgid "RDONLY " -msgstr "参照のみ " +msgstr "蜿らァ縺ョ縺ソ " #: ../web/statuspage.c:124 msgid "WRONLY " -msgstr "更新のみ " +msgstr "譖エ譁ー縺ョ縺ソ " #: ../web/statuspage.c:125 msgid "RDWR " -msgstr "参照/更新 " +msgstr "蜿らァ/譖エ譁ー " #: ../web/statuspage.c:309 msgid "Server Status" -msgstr "サーバの状態" +msgstr "繧オ繝シ繝舌ョ迥カ諷" #: ../web/statuspage.c:314 msgid "Auto Refresh" -msgstr "自動更新の開始" +msgstr "閾ェ蜍墓峩譁ー縺ョ髢句ァ" #: ../web/statuspage.c:315 ../web/statuspage.c:320 msgid "Refresh Interval: " -msgstr "更新間隔: " +msgstr "譖エ譁ー髢馴囈: " #: ../web/statuspage.c:319 msgid "Stop Refreshing" -msgstr "自動更新の停止" +msgstr "閾ェ蜍墓峩譁ー縺ョ蛛懈ュ「" #: ../web/statuspage.c:334 msgid "version:" -msgstr "バージョン" +msgstr "繝舌シ繧ク繝ァ繝ウ" #: ../web/statuspage.c:337 msgid "smbd:" @@ -398,23 +398,23 @@ msgstr "" #: ../web/statuspage.c:337 ../web/statuspage.c:350 ../web/statuspage.c:364 msgid "running" -msgstr "実行中" +msgstr "螳溯。御クュ" #: ../web/statuspage.c:337 ../web/statuspage.c:350 ../web/statuspage.c:364 msgid "not running" -msgstr "停止中" +msgstr "蛛懈ュ「荳ュ" #: ../web/statuspage.c:341 msgid "Stop smbd" -msgstr "smbd の停止" +msgstr "smbd 縺ョ蛛懈ュ「" #: ../web/statuspage.c:343 msgid "Start smbd" -msgstr "smbd の起動" +msgstr "smbd 縺ョ襍キ蜍" #: ../web/statuspage.c:345 msgid "Restart smbd" -msgstr "smbd の再起動" +msgstr "smbd 縺ョ蜀崎オキ蜍" #: ../web/statuspage.c:350 msgid "nmbd:" @@ -422,15 +422,15 @@ msgstr "" #: ../web/statuspage.c:354 msgid "Stop nmbd" -msgstr "nmbd の停止" +msgstr "nmbd 縺ョ蛛懈ュ「" #: ../web/statuspage.c:356 msgid "Start nmbd" -msgstr "nmbd の起動" +msgstr "nmbd 縺ョ襍キ蜍" #: ../web/statuspage.c:358 msgid "Restart nmbd" -msgstr "nmbd の再起動" +msgstr "nmbd 縺ョ蜀崎オキ蜍" #: ../web/statuspage.c:364 msgid "winbindd:" @@ -438,33 +438,33 @@ msgstr "" #: ../web/statuspage.c:368 msgid "Stop winbindd" -msgstr "winbindd の停止" +msgstr "winbindd 縺ョ蛛懈ュ「" #: ../web/statuspage.c:370 msgid "Start winbindd" -msgstr "winbindd の起動" +msgstr "winbindd 縺ョ襍キ蜍" #: ../web/statuspage.c:372 msgid "Restart winbindd" -msgstr "winbindd の再起動" +msgstr "winbindd 縺ョ蜀崎オキ蜍" #. stop, restart all #: ../web/statuspage.c:381 msgid "Stop All" -msgstr "すべて停止" +msgstr "縺吶∋縺ヲ蛛懈ュ「" #: ../web/statuspage.c:382 msgid "Restart All" -msgstr "すべて再起動" +msgstr "縺吶∋縺ヲ蜀崎オキ蜍" #. start all #: ../web/statuspage.c:386 msgid "Start All" -msgstr "すべて起動" +msgstr "縺吶∋縺ヲ襍キ蜍" #: ../web/statuspage.c:393 msgid "Active Connections" -msgstr "接続中のクライアント" +msgstr "謗・邯壻クュ縺ョ繧ッ繝ゥ繧、繧「繝ウ繝" #: ../web/statuspage.c:395 ../web/statuspage.c:408 ../web/statuspage.c:416 msgid "PID" @@ -472,47 +472,47 @@ msgstr "" #: ../web/statuspage.c:395 ../web/statuspage.c:408 msgid "Client" -msgstr "クライアント" +msgstr "繧ッ繝ゥ繧、繧「繝ウ繝" #: ../web/statuspage.c:395 msgid "IP address" -msgstr "IPアドレス" +msgstr "IP繧「繝峨Ξ繧ケ" #: ../web/statuspage.c:395 ../web/statuspage.c:408 ../web/statuspage.c:416 msgid "Date" -msgstr "日付" +msgstr "譌・莉" #: ../web/statuspage.c:397 msgid "Kill" -msgstr "切断" +msgstr "蛻譁ュ" #: ../web/statuspage.c:405 msgid "Active Shares" -msgstr "接続中の共有" +msgstr "謗・邯壻クュ縺ョ蜈ア譛" #: ../web/statuspage.c:408 msgid "Share" -msgstr "共有名" +msgstr "蜈ア譛牙錐" #: ../web/statuspage.c:408 msgid "User" -msgstr "ユーザ" +msgstr "繝ヲ繝シ繧カ" #: ../web/statuspage.c:408 msgid "Group" -msgstr "グループ" +msgstr "繧ー繝ォ繝シ繝" #: ../web/statuspage.c:414 msgid "Open Files" -msgstr "使用中のファイル" +msgstr "菴ソ逕ィ荳ュ縺ョ繝輔ぃ繧、繝ォ" #: ../web/statuspage.c:416 msgid "Sharing" -msgstr "排他モード" +msgstr "謗剃サ悶Δ繝シ繝" #: ../web/statuspage.c:416 msgid "R/W" -msgstr "参照/更新" +msgstr "蜿らァ/譖エ譁ー" #: ../web/statuspage.c:416 msgid "Oplock" @@ -520,76 +520,76 @@ msgstr "" #: ../web/statuspage.c:416 msgid "File" -msgstr "ファイル名" +msgstr "繝輔ぃ繧、繝ォ蜷" #: ../web/statuspage.c:425 msgid "Show Client in col 1" -msgstr "クライアント名を先頭に表示" +msgstr "繧ッ繝ゥ繧、繧「繝ウ繝亥錐繧貞磯ュ縺ォ陦ィ遉コ" #: ../web/statuspage.c:426 msgid "Show PID in col 1" -msgstr "PIDを先頭に表示" +msgstr "PID繧貞磯ュ縺ォ陦ィ遉コ" #: ../param/loadparm.c:755 msgid "Base Options" -msgstr "基本 オプション" +msgstr "蝓コ譛ャ 繧ェ繝励す繝ァ繝ウ" #: ../param/loadparm.c:775 msgid "Security Options" -msgstr "セキュリティ オプション" +msgstr "繧サ繧ュ繝・繝ェ繝繧」 繧ェ繝励す繝ァ繝ウ" #: ../param/loadparm.c:859 msgid "Logging Options" -msgstr "ロギング オプション" +msgstr "繝ュ繧ョ繝ウ繧ー 繧ェ繝励す繝ァ繝ウ" #: ../param/loadparm.c:874 msgid "Protocol Options" -msgstr "プロトコル オプション" +msgstr "繝励Ο繝医さ繝ォ 繧ェ繝励す繝ァ繝ウ" #: ../param/loadparm.c:911 msgid "Tuning Options" -msgstr "チューニング オプション" +msgstr "繝√Η繝シ繝九Φ繧ー 繧ェ繝励す繝ァ繝ウ" #: ../param/loadparm.c:940 msgid "Printing Options" -msgstr "印刷 オプション" +msgstr "蜊ー蛻キ 繧ェ繝励す繝ァ繝ウ" #: ../param/loadparm.c:970 msgid "Filename Handling" -msgstr "ファイル名の取扱" +msgstr "繝輔ぃ繧、繝ォ蜷阪ョ蜿匁桶" #: ../param/loadparm.c:996 msgid "Domain Options" -msgstr "ドメイン オプション" +msgstr "繝峨Γ繧、繝ウ 繧ェ繝励す繝ァ繝ウ" #: ../param/loadparm.c:1000 msgid "Logon Options" -msgstr "ログオン オプション" +msgstr "繝ュ繧ー繧ェ繝ウ 繧ェ繝励す繝ァ繝ウ" #: ../param/loadparm.c:1019 msgid "Browse Options" -msgstr "ブラウジング オプション" +msgstr "繝悶Λ繧ヲ繧ク繝ウ繧ー 繧ェ繝励す繝ァ繝ウ" #: ../param/loadparm.c:1033 msgid "WINS Options" -msgstr "WINS オプション" +msgstr "WINS 繧ェ繝励す繝ァ繝ウ" #: ../param/loadparm.c:1043 msgid "Locking Options" -msgstr "ロッキング オプション" +msgstr "繝ュ繝繧ュ繝ウ繧ー 繧ェ繝励す繝ァ繝ウ" #: ../param/loadparm.c:1061 msgid "Ldap Options" -msgstr "LDAP オプション" +msgstr "LDAP 繧ェ繝励す繝ァ繝ウ" #: ../param/loadparm.c:1078 msgid "Miscellaneous Options" -msgstr "その他のオプション" +msgstr "縺昴ョ莉悶ョ繧ェ繝励す繝ァ繝ウ" #: ../param/loadparm.c:1138 msgid "VFS module options" -msgstr "VFS オプション" +msgstr "VFS 繧ェ繝励す繝ァ繝ウ" #: ../param/loadparm.c:1148 msgid "Winbind options" -msgstr "Winbind オプション" +msgstr "Winbind 繧ェ繝励す繝ァ繝ウ" diff --git a/source/po/nl.msg b/source/po/nl.msg index 8d7b050ce90..b9f64234d6e 100644 --- a/source/po/nl.msg +++ b/source/po/nl.msg @@ -23,7 +23,7 @@ msgstr "" "Last-Translator: Jelmer Vernooij <jelmer@samba.org>\n" "Language-Team: (Samba Team) <samba-technical@samba.org>\n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=US-ASCII\n" +"Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" #: ../web/swat.c:117 diff --git a/source/po/pl.msg b/source/po/pl.msg index a7e56453bfc..6bc98f99d61 100644 --- a/source/po/pl.msg +++ b/source/po/pl.msg @@ -23,7 +23,7 @@ msgstr "" "Last-Translator: Rafal Szczesniak <mimir@spin.ict.pwr.wroc.pl>\n" "Language-Team: pl\n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=iso-8859-2\n" +"Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" #: ../web/swat.c:117 @@ -37,7 +37,7 @@ msgstr "Pomoc" #: ../web/swat.c:206 ../web/swat.c:220 ../web/swat.c:235 ../web/swat.c:243 ../web/swat.c:252 ../web/swat.c:261 ../web/swat.c:267 ../web/swat.c:273 ../web/swat.c:286 msgid "Set Default" -msgstr "Ustaw domyカlnie" +msgstr "Ustaw domyナ嬪nie" #: ../web/swat.c:408 #, c-format @@ -64,7 +64,7 @@ msgstr "Ustawienia globalne" #: ../web/swat.c:508 msgid "Shares" -msgstr "Wspウudziaウy" +msgstr "WspテウナVdziaナZ" #: ../web/swat.c:509 msgid "Printers" @@ -80,15 +80,15 @@ msgstr "Status" #: ../web/swat.c:514 msgid "View Config" -msgstr "Przejrzyj Konfiguracj" +msgstr "Przejrzyj Konfiguracjト" #: ../web/swat.c:516 msgid "Password Management" -msgstr "Zarzアdzanie Hasウami" +msgstr "Zarzトdzanie HasナBmi" #: ../web/swat.c:526 msgid "Current View Is" -msgstr "Bieソアca Konfiguracja" +msgstr "Bieナシトca Konfiguracja" #: ../web/swat.c:527 ../web/swat.c:530 msgid "Basic" @@ -100,11 +100,11 @@ msgstr "Widok Zaawansowany" #: ../web/swat.c:529 msgid "Change View To" -msgstr "Zmie Hasウo" +msgstr "Zmieナ HasナP" #: ../web/swat.c:554 msgid "Current Config" -msgstr "Bieソアca Konfiguracja" +msgstr "Bieナシトca Konfiguracja" #: ../web/swat.c:558 msgid "Normal View" @@ -112,7 +112,7 @@ msgstr "Normalny Widok" #: ../web/swat.c:560 msgid "Full View" -msgstr "Peウny Widok" +msgstr "PeナOy Widok" #. Here we first set and commit all the parameters that were selected #. in the previous screen. @@ -143,7 +143,7 @@ msgstr "" #: ../web/swat.c:725 msgid "Commit" -msgstr "Potwierdシ Zmiany" +msgstr "Potwierdナコ Zmiany" #: ../web/swat.c:726 msgid "Edit Parameter Values" @@ -211,31 +211,31 @@ msgstr "Zmienne Globalne" #: ../web/swat.c:815 ../web/swat.c:916 ../web/swat.c:1265 msgid "Commit Changes" -msgstr "Potwierdシ Zmiany" +msgstr "Potwierdナコ Zmiany" #: ../web/swat.c:819 ../web/swat.c:919 ../web/swat.c:1267 msgid "Reset Values" -msgstr "Zresetuj Wartoカci" +msgstr "Zresetuj Wartoナ嫩i" #: ../web/swat.c:844 msgid "Share Parameters" -msgstr "Parametry Wspウudziaウu" +msgstr "Parametry WspテウナVdziaナV" #: ../web/swat.c:887 msgid "Choose Share" -msgstr "Wybierz Wspウudziaウ" +msgstr "Wybierz WspテウナVdziaナ" #: ../web/swat.c:901 msgid "Delete Share" -msgstr "Usu Wspウudziaウ" +msgstr "Usuナ WspテウナVdziaナ" #: ../web/swat.c:908 msgid "Create Share" -msgstr "Utwrz Wspウudziaウ" +msgstr "Utwテウrz WspテウナVdziaナ" #: ../web/swat.c:944 msgid "password change in demo mode rejected" -msgstr "zmiana hasウa w trybie demo odrzucona\n" +msgstr "zmiana hasナB w trybie demo odrzucona\n" #: ../web/swat.c:957 msgid "Can't setup password database vectors." @@ -243,80 +243,80 @@ msgstr "" #: ../web/swat.c:983 msgid " Must specify \"User Name\" " -msgstr " Musisz poda \"Nazw Uソytkownika\" \n" +msgstr " Musisz podaト \"Nazwト Uナシytkownika\" \n" #: ../web/swat.c:999 msgid " Must specify \"Old Password\" " -msgstr " Musisz poda \"Stare Hasウo\" \n" +msgstr " Musisz podaト \"Stare HasナP\" \n" #: ../web/swat.c:1005 msgid " Must specify \"Remote Machine\" " -msgstr " Musisz poda \"Zdalnア Maszyn鷭" \n" +msgstr " Musisz podaト \"Zdalnト Maszynト兔" \n" #: ../web/swat.c:1012 msgid " Must specify \"New, and Re-typed Passwords\" " -msgstr " Musisz poda \"Nowe Hasウo, i ponownie wpisane Nowe Hasウo\" \n" +msgstr " Musisz podaト \"Nowe HasナP, i ponownie wpisane Nowe HasナP\" \n" #: ../web/swat.c:1018 msgid " Re-typed password didn't match new password " -msgstr " Ponownie wpisane hasウo nie pasuje do nowego hasウa\n" +msgstr " Ponownie wpisane hasナP nie pasuje do nowego hasナB\n" #: ../web/swat.c:1048 #, c-format msgid " The passwd for '%s' has been changed." -msgstr " Hasウo dla '%s' zostaウo zmienione. \n" +msgstr " HasナP dla '%s' zostaナP zmienione. \n" #: ../web/swat.c:1051 #, c-format msgid " The passwd for '%s' has NOT been changed." -msgstr " Hasウo dla '%s' NIE zostaウo zmienione. \n" +msgstr " HasナP dla '%s' NIE zostaナP zmienione. \n" #: ../web/swat.c:1076 msgid "Server Password Management" -msgstr "Zarzアdzanie Hasウami na Serwerze" +msgstr "Zarzトdzanie HasナBmi na Serwerze" #. #. * Create all the dialog boxes for data collection #. #: ../web/swat.c:1085 ../web/swat.c:1132 msgid "User Name" -msgstr " Nazwa Uソytkownika" +msgstr " Nazwa Uナシytkownika" #: ../web/swat.c:1088 ../web/swat.c:1134 msgid "Old Password" -msgstr " Stare Hasウo" +msgstr " Stare HasナP" #: ../web/swat.c:1091 ../web/swat.c:1136 msgid "New Password" -msgstr " Nowe Hasウo" +msgstr " Nowe HasナP" #: ../web/swat.c:1093 ../web/swat.c:1138 msgid "Re-type New Password" -msgstr " Ponownie wpisz Nowe Hasウo" +msgstr " Ponownie wpisz Nowe HasナP" #: ../web/swat.c:1101 ../web/swat.c:1149 msgid "Change Password" -msgstr "Zmie Hasウo" +msgstr "Zmieナ HasナP" #: ../web/swat.c:1104 msgid "Add New User" -msgstr "Dodaj Nowego Uソytkownika" +msgstr "Dodaj Nowego Uナシytkownika" #: ../web/swat.c:1106 msgid "Delete User" -msgstr "Usu Uソytkownika" +msgstr "Usuナ Uナシytkownika" #: ../web/swat.c:1108 msgid "Disable User" -msgstr "Zablokuj Uソytkownika" +msgstr "Zablokuj Uナシytkownika" #: ../web/swat.c:1110 msgid "Enable User" -msgstr "Odblokuj Uソytkownika" +msgstr "Odblokuj Uナシytkownika" #: ../web/swat.c:1123 msgid "Client/Server Password Management" -msgstr "Zarzアdzanie Hasウami Klient/Serwer" +msgstr "Zarzトdzanie HasナBmi Klient/Serwer" #: ../web/swat.c:1140 msgid "Remote Machine" @@ -328,15 +328,15 @@ msgstr "Parametry Drukarki" #: ../web/swat.c:1181 msgid "Important Note:" -msgstr "Waソna Informacja:" +msgstr "Waナシna Informacja:" #: ../web/swat.c:1182 msgid "Printer names marked with [*] in the Choose Printer drop-down box " -msgstr "Nazwy Drukarek zaznaczone [*] w rozwijanym polu Wybierz Drukark " +msgstr "Nazwy Drukarek zaznaczone [*] w rozwijanym polu Wybierz Drukarkト " #: ../web/swat.c:1183 msgid "are autoloaded printers from " -msgstr "sア drukarkami automatycznie ウadowanymi z " +msgstr "sト drukarkami automatycznie ナBdowanymi z " #: ../web/swat.c:1184 msgid "Printcap Name" @@ -344,19 +344,19 @@ msgstr "Nazwa Printcap" #: ../web/swat.c:1185 msgid "Attempting to delete these printers from SWAT will have no effect." -msgstr "Prby usuni鹹ia tych drukarek ze SWAT nie przyniosア efektu.\n" +msgstr "Prテウby usuniト冂ia tych drukarek ze SWAT nie przyniosト efektu.\n" #: ../web/swat.c:1231 msgid "Choose Printer" -msgstr "Wybierz Drukark" +msgstr "Wybierz Drukarkト" #: ../web/swat.c:1250 msgid "Delete Printer" -msgstr "Usu Drukark" +msgstr "Usuナ Drukarkト" #: ../web/swat.c:1257 msgid "Create Printer" -msgstr "Utwrz Drukark" +msgstr "Utwテウrz Drukarkト" #: ../web/statuspage.c:123 msgid "RDONLY " @@ -376,15 +376,15 @@ msgstr "Status Serwera" #: ../web/statuspage.c:314 msgid "Auto Refresh" -msgstr "Automatyczne Odカwieソanie" +msgstr "Automatyczne Odナ孩ieナシanie" #: ../web/statuspage.c:315 ../web/statuspage.c:320 msgid "Refresh Interval: " -msgstr "Interwaウ Odカwieソania: " +msgstr "Interwaナ Odナ孩ieナシania: " #: ../web/statuspage.c:319 msgid "Stop Refreshing" -msgstr "Zatrzymaj Odカwieソanie" +msgstr "Zatrzymaj Odナ孩ieナシanie" #: ../web/statuspage.c:334 msgid "version:" @@ -396,11 +396,11 @@ msgstr "" #: ../web/statuspage.c:337 ../web/statuspage.c:350 ../web/statuspage.c:364 msgid "running" -msgstr "dziaウa" +msgstr "dziaナB" #: ../web/statuspage.c:337 ../web/statuspage.c:350 ../web/statuspage.c:364 msgid "not running" -msgstr "nie dziaウa" +msgstr "nie dziaナB" #: ../web/statuspage.c:341 msgid "Stop smbd" @@ -462,7 +462,7 @@ msgstr "Uruchom nmbd" #: ../web/statuspage.c:393 msgid "Active Connections" -msgstr "Aktywne Poウアczenia" +msgstr "Aktywne Poナてczenia" #: ../web/statuspage.c:395 ../web/statuspage.c:408 ../web/statuspage.c:416 msgid "PID" @@ -486,15 +486,15 @@ msgstr "Zatrzymaj" #: ../web/statuspage.c:405 msgid "Active Shares" -msgstr "Aktywne Wspウudziaウy" +msgstr "Aktywne WspテウナVdziaナZ" #: ../web/statuspage.c:408 msgid "Share" -msgstr "Wspウudziaウ" +msgstr "WspテウナVdziaナ" #: ../web/statuspage.c:408 msgid "User" -msgstr "Uソytkownik" +msgstr "Uナシytkownik" #: ../web/statuspage.c:408 msgid "Group" @@ -506,7 +506,7 @@ msgstr "Otwarte Pliki" #: ../web/statuspage.c:416 msgid "Sharing" -msgstr "Wspウdzielenie" +msgstr "WspテウナEzielenie" #: ../web/statuspage.c:416 msgid "R/W" @@ -534,7 +534,7 @@ msgstr "Bazowe Opcje" #: ../param/loadparm.c:775 msgid "Security Options" -msgstr "Opcje Zabezpiecze" +msgstr "Opcje Zabezpieczeナ" #: ../param/loadparm.c:859 msgid "Logging Options" @@ -542,11 +542,11 @@ msgstr "Opcje Blokowania" #: ../param/loadparm.c:874 msgid "Protocol Options" -msgstr "Opcje Protokoウu" +msgstr "Opcje ProtokoナV" #: ../param/loadparm.c:911 msgid "Tuning Options" -msgstr "Opcje Dostrajajアce" +msgstr "Opcje Dostrajajトce" #: ../param/loadparm.c:940 msgid "Printing Options" @@ -554,7 +554,7 @@ msgstr "Opcje Drukowania" #: ../param/loadparm.c:970 msgid "Filename Handling" -msgstr "Obsウuga Nazw Plikw" +msgstr "ObsナVga Nazw Plikテウw" #: ../param/loadparm.c:996 msgid "Domain Options" @@ -566,7 +566,7 @@ msgstr "Opcje Logowania" #: ../param/loadparm.c:1019 msgid "Browse Options" -msgstr "Opcje Przeglアdania" +msgstr "Opcje Przeglトdania" #: ../param/loadparm.c:1033 msgid "WINS Options" @@ -582,7 +582,7 @@ msgstr "Opcje Ldap" #: ../param/loadparm.c:1078 msgid "Miscellaneous Options" -msgstr "Pozostaウe Opcje" +msgstr "PozostaナF Opcje" #: ../param/loadparm.c:1138 msgid "VFS module options" diff --git a/source/po/tr.msg b/source/po/tr.msg index 8ef551da46a..2170d8bdf97 100644 --- a/source/po/tr.msg +++ b/source/po/tr.msg @@ -23,7 +23,7 @@ msgstr "" "Last-Translator: Deniz Akkus Kanca <deniz@arayan.com>\n" "Language-Team: Turkish <gnu-tr-u12a@lists.sourceforge.net>\n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=ISO-8859-9\n" +"Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: KBabel 0.9.1\n" @@ -34,11 +34,11 @@ msgstr "" #: ../web/swat.c:200 msgid "Help" -msgstr "Yardm" +msgstr "Yardトアm" #: ../web/swat.c:206 ../web/swat.c:220 ../web/swat.c:235 ../web/swat.c:243 ../web/swat.c:252 ../web/swat.c:261 ../web/swat.c:267 ../web/swat.c:273 ../web/swat.c:286 msgid "Set Default" -msgstr "ヨntanmlya Ayarla" +msgstr "テ墨tanトアmlトアya Ayarla" #: ../web/swat.c:408 #, c-format @@ -53,7 +53,7 @@ msgstr "" #: ../web/swat.c:501 #, c-format msgid "Logged in as <b>%s</b>" -msgstr "<b>%s</b> kimlii ile oturum alm" +msgstr "<b>%s</b> kimliト殃 ile oturum aテァトアlmトアナ" #: ../web/swat.c:505 msgid "Home" @@ -65,11 +65,11 @@ msgstr "Evrenseller" #: ../web/swat.c:508 msgid "Shares" -msgstr "Paylamlar" +msgstr "Paylaナ淨アmlar" #: ../web/swat.c:509 msgid "Printers" -msgstr "Yazclar" +msgstr "Yazトアcトアlar" #: ../web/swat.c:510 msgid "Wizard" @@ -81,39 +81,39 @@ msgstr "Durum" #: ../web/swat.c:514 msgid "View Config" -msgstr "Ayarlara Gzat" +msgstr "Ayarlara Gテカzat" #: ../web/swat.c:516 msgid "Password Management" -msgstr "゙ifre Ynetimi" +msgstr "ナ枴fre Yテカnetimi" #: ../web/swat.c:526 msgid "Current View Is" -msgstr "゙imdiki Ayarlar" +msgstr "ナ枴mdiki Ayarlar" #: ../web/swat.c:527 ../web/swat.c:530 msgid "Basic" -msgstr "Temel Grnm" +msgstr "Temel Gテカrテシnテシm" #: ../web/swat.c:528 ../web/swat.c:531 msgid "Advanced" -msgstr "Gelimi Grnm" +msgstr "Geliナ殞iナ Gテカrテシnテシm" #: ../web/swat.c:529 msgid "Change View To" -msgstr "゙ifre Deitir" +msgstr "ナ枴fre Deト殃ナ殳ir" #: ../web/swat.c:554 msgid "Current Config" -msgstr "゙imdiki Ayarlar" +msgstr "ナ枴mdiki Ayarlar" #: ../web/swat.c:558 msgid "Normal View" -msgstr "Normal Grnm" +msgstr "Normal Gテカrテシnテシm" #: ../web/swat.c:560 msgid "Full View" -msgstr "Tam Grnm" +msgstr "Tam Gテカrテシnテシm" #. Here we first set and commit all the parameters that were selected #. in the previous screen. @@ -144,11 +144,11 @@ msgstr "" #: ../web/swat.c:725 msgid "Commit" -msgstr "aklama" +msgstr "aテァトアklama" #: ../web/swat.c:726 msgid "Edit Parameter Values" -msgstr "Yazc Bilgileri" +msgstr "Yazトアcトア Bilgileri" #: ../web/swat.c:732 msgid "Server Type" @@ -156,7 +156,7 @@ msgstr "" #: ../web/swat.c:733 msgid "Stand Alone" -msgstr "Nmbd'yi 軋ltr" +msgstr "Nmbd'yi テァalトアナ殳トアr" #: ../web/swat.c:734 msgid "Domain Member" @@ -208,35 +208,35 @@ msgstr "" #: ../web/swat.c:787 msgid "Global Parameters" -msgstr "Genel Deikenler" +msgstr "Genel Deト殃ナ殘enler" #: ../web/swat.c:815 ../web/swat.c:916 ../web/swat.c:1265 msgid "Commit Changes" -msgstr "Deiiklikleri Kaydet" +msgstr "Deト殃ナ殃klikleri Kaydet" #: ../web/swat.c:819 ../web/swat.c:919 ../web/swat.c:1267 msgid "Reset Values" -msgstr "Deerleri ンlk Haline Getir" +msgstr "Deト歹rleri トーlk Haline Getir" #: ../web/swat.c:844 msgid "Share Parameters" -msgstr "Paylam Parametreleri" +msgstr "Paylaナ淨アm Parametreleri" #: ../web/swat.c:887 msgid "Choose Share" -msgstr "Paylam Se輅n" +msgstr "Paylaナ淨アm Seテァin" #: ../web/swat.c:901 msgid "Delete Share" -msgstr "Paylam Kaldr" +msgstr "Paylaナ淨アm Kaldトアr" #: ../web/swat.c:908 msgid "Create Share" -msgstr "Paylam Olutur" +msgstr "Paylaナ淨アm Oluナ殳ur" #: ../web/swat.c:944 msgid "password change in demo mode rejected" -msgstr "demo kipinde ifre deiiklii kabul edilmedi\n" +msgstr "demo kipinde ナ殃fre deト殃ナ殃kliト殃 kabul edilmedi\n" #: ../web/swat.c:957 msgid "Can't setup password database vectors." @@ -244,11 +244,11 @@ msgstr "" #: ../web/swat.c:983 msgid " Must specify \"User Name\" " -msgstr " \"Kullanc Ad\" belirtilmeli \n" +msgstr " \"Kullanトアcトア Adトア\" belirtilmeli \n" #: ../web/swat.c:999 msgid " Must specify \"Old Password\" " -msgstr " \"Eski ゙ifre\" belirtilmeli \n" +msgstr " \"Eski ナ枴fre\" belirtilmeli \n" #: ../web/swat.c:1005 msgid " Must specify \"Remote Machine\" " @@ -256,48 +256,48 @@ msgstr " \"Uzak Makina\" belirtilmeli \n" #: ../web/swat.c:1012 msgid " Must specify \"New, and Re-typed Passwords\" " -msgstr " \"Yeni ve Tekrar Girilmi ゙ifreler\" belirtilmeli \n" +msgstr " \"Yeni ve Tekrar Girilmiナ ナ枴freler\" belirtilmeli \n" #: ../web/swat.c:1018 msgid " Re-typed password didn't match new password " -msgstr " Tekrar girilen ifre yeni ifre ile elemedi\n" +msgstr " Tekrar girilen ナ殃fre yeni ナ殃fre ile eナ殕eナ殞edi\n" #: ../web/swat.c:1048 #, c-format msgid " The passwd for '%s' has been changed." -msgstr " '%s' i輅n ifre deitirildi." +msgstr " '%s' iテァin ナ殃fre deト殃ナ殳irildi." #: ../web/swat.c:1051 #, c-format msgid " The passwd for '%s' has NOT been changed." -msgstr " '%s' i輅n ifre DEミン゙TンRンLMEDン." +msgstr " '%s' iテァin ナ殃fre DEト榮ーナ杁トーRトーLMEDトー." #: ../web/swat.c:1076 msgid "Server Password Management" -msgstr "Sunucu ゙ifre Ynetimi" +msgstr "Sunucu ナ枴fre Yテカnetimi" #. #. * Create all the dialog boxes for data collection #. #: ../web/swat.c:1085 ../web/swat.c:1132 msgid "User Name" -msgstr " Kullanc Ad" +msgstr " Kullanトアcトア Adトア" #: ../web/swat.c:1088 ../web/swat.c:1134 msgid "Old Password" -msgstr " Eski ゙ifre" +msgstr " Eski ナ枴fre" #: ../web/swat.c:1091 ../web/swat.c:1136 msgid "New Password" -msgstr " Yeni ゙ifre" +msgstr " Yeni ナ枴fre" #: ../web/swat.c:1093 ../web/swat.c:1138 msgid "Re-type New Password" -msgstr " Yeni ゙ifre Tekrar" +msgstr " Yeni ナ枴fre Tekrarトア" #: ../web/swat.c:1101 ../web/swat.c:1149 msgid "Change Password" -msgstr "゙ifre Deitir" +msgstr "ナ枴fre Deト殃ナ殳ir" #: ../web/swat.c:1104 msgid "Add New User" @@ -309,15 +309,15 @@ msgstr "Kull. Sil" #: ../web/swat.c:1108 msgid "Disable User" -msgstr "Kull. Etkisizletir" +msgstr "Kull. Etkisizleナ殳ir" #: ../web/swat.c:1110 msgid "Enable User" -msgstr "Kull. Etkinletir" +msgstr "Kull. Etkinleナ殳ir" #: ../web/swat.c:1123 msgid "Client/Server Password Management" -msgstr "ンstemci/Sunucu ゙ifre Ynetimi" +msgstr "トーstemci/Sunucu ナ枴fre Yテカnetimi" #: ../web/swat.c:1140 msgid "Remote Machine" @@ -325,39 +325,39 @@ msgstr " Uzak Makina" #: ../web/swat.c:1179 msgid "Printer Parameters" -msgstr "Yazc Bilgileri" +msgstr "Yazトアcトア Bilgileri" #: ../web/swat.c:1181 msgid "Important Note:" -msgstr "ヨnemli Not:" +msgstr "テ墨emli Not:" #: ../web/swat.c:1182 msgid "Printer names marked with [*] in the Choose Printer drop-down box " -msgstr "Yazc Se kutusunda [*] ile iaretlenmi yazc isimleri " +msgstr "Yazトアcトア Seテァ kutusunda [*] ile iナ歛retlenmiナ yazトアcトア isimleri " #: ../web/swat.c:1183 msgid "are autoloaded printers from " -msgstr "otomatik yklenen yazclar " +msgstr "otomatik yテシklenen yazトアcトアlar " #: ../web/swat.c:1184 msgid "Printcap Name" -msgstr "Printcap Ad" +msgstr "Printcap Adトア" #: ../web/swat.c:1185 msgid "Attempting to delete these printers from SWAT will have no effect." -msgstr "Bu yazclar SWAT'dan silmek etkisiz olacaktr.\n" +msgstr "Bu yazトアcトアlarトア SWAT'dan silmek etkisiz olacaktトアr.\n" #: ../web/swat.c:1231 msgid "Choose Printer" -msgstr "Yazc Se" +msgstr "Yazトアcトア Seテァ" #: ../web/swat.c:1250 msgid "Delete Printer" -msgstr "Yazc Sil" +msgstr "Yazトアcトア Sil" #: ../web/swat.c:1257 msgid "Create Printer" -msgstr "Yazc Olutur" +msgstr "Yazトアcトア Oluナ殳ur" #: ../web/statuspage.c:123 msgid "RDONLY " @@ -381,7 +381,7 @@ msgstr "Oto Tazele" #: ../web/statuspage.c:315 ../web/statuspage.c:320 msgid "Refresh Interval: " -msgstr "Tazeleme Aral: " +msgstr "Tazeleme Aralトアト淨ア: " #: ../web/statuspage.c:319 msgid "Stop Refreshing" @@ -389,7 +389,7 @@ msgstr "Tazelemeyi Durdur" #: ../web/statuspage.c:334 msgid "version:" -msgstr "srm:" +msgstr "sテシrテシm:" #: ../web/statuspage.c:337 msgid "smbd:" @@ -397,11 +397,11 @@ msgstr "smbd:" #: ../web/statuspage.c:337 ../web/statuspage.c:350 ../web/statuspage.c:364 msgid "running" -msgstr "軋lyor" +msgstr "テァalトアナ淨アyor" #: ../web/statuspage.c:337 ../web/statuspage.c:350 ../web/statuspage.c:364 msgid "not running" -msgstr "軋lmyor" +msgstr "テァalトアナ殞トアyor" #: ../web/statuspage.c:341 msgid "Stop smbd" @@ -409,11 +409,11 @@ msgstr "Smbd'yi durdur" #: ../web/statuspage.c:343 msgid "Start smbd" -msgstr "Smbd'yi 軋ltr" +msgstr "Smbd'yi テァalトアナ殳トアr" #: ../web/statuspage.c:345 msgid "Restart smbd" -msgstr "Smbd'yi yeniden 軋ltr" +msgstr "Smbd'yi yeniden テァalトアナ殳トアr" #: ../web/statuspage.c:350 msgid "nmbd:" @@ -425,11 +425,11 @@ msgstr "Nmbd'yi durdur" #: ../web/statuspage.c:356 msgid "Start nmbd" -msgstr "Nmbd'yi 軋ltr" +msgstr "Nmbd'yi テァalトアナ殳トアr" #: ../web/statuspage.c:358 msgid "Restart nmbd" -msgstr "Nmbd'yi yeniden 軋ltr" +msgstr "Nmbd'yi yeniden テァalトアナ殳トアr" #: ../web/statuspage.c:364 msgid "winbindd:" @@ -441,11 +441,11 @@ msgstr "Nmbd'yi durdur" #: ../web/statuspage.c:370 msgid "Start winbindd" -msgstr "Nmbd'yi 軋ltr" +msgstr "Nmbd'yi テァalトアナ殳トアr" #: ../web/statuspage.c:372 msgid "Restart winbindd" -msgstr "Nmbd'yi yeniden 軋ltr" +msgstr "Nmbd'yi yeniden テァalトアナ殳トアr" #. stop, restart all #: ../web/statuspage.c:381 @@ -454,16 +454,16 @@ msgstr "" #: ../web/statuspage.c:382 msgid "Restart All" -msgstr "Nmbd'yi yeniden 軋ltr" +msgstr "Nmbd'yi yeniden テァalトアナ殳トアr" #. start all #: ../web/statuspage.c:386 msgid "Start All" -msgstr "Nmbd'yi 軋ltr" +msgstr "Nmbd'yi テァalトアナ殳トアr" #: ../web/statuspage.c:393 msgid "Active Connections" -msgstr "Aktif Balantlar" +msgstr "Aktif Baト殕antトアlar" #: ../web/statuspage.c:395 ../web/statuspage.c:408 ../web/statuspage.c:416 msgid "PID" @@ -471,11 +471,11 @@ msgstr "PID" #: ../web/statuspage.c:395 ../web/statuspage.c:408 msgid "Client" -msgstr "ンstemci" +msgstr "トーstemci" #: ../web/statuspage.c:395 msgid "IP address" -msgstr "IP numaras" +msgstr "IP numarasトア" #: ../web/statuspage.c:395 ../web/statuspage.c:408 ../web/statuspage.c:416 msgid "Date" @@ -487,15 +487,15 @@ msgstr "Kapat" #: ../web/statuspage.c:405 msgid "Active Shares" -msgstr "Aktif Paylamlar" +msgstr "Aktif Paylaナ淨アmlar" #: ../web/statuspage.c:408 msgid "Share" -msgstr "Paylam" +msgstr "Paylaナ淨アm" #: ../web/statuspage.c:408 msgid "User" -msgstr "Kullanc" +msgstr "Kullanトアcトア" #: ../web/statuspage.c:408 msgid "Group" @@ -503,11 +503,11 @@ msgstr "Grup" #: ../web/statuspage.c:414 msgid "Open Files" -msgstr "Ak Dosyalar" +msgstr "Aテァトアk Dosyalar" #: ../web/statuspage.c:416 msgid "Sharing" -msgstr "Paylalyor" +msgstr "Paylaナ淨アlトアyor" #: ../web/statuspage.c:416 msgid "R/W" @@ -531,64 +531,64 @@ msgstr "" #: ../param/loadparm.c:755 msgid "Base Options" -msgstr "Temel Se軻nekler" +msgstr "Temel Seテァenekler" #: ../param/loadparm.c:775 msgid "Security Options" -msgstr "Gvenlik Se軻nekleri" +msgstr "Gテシvenlik Seテァenekleri" #: ../param/loadparm.c:859 msgid "Logging Options" -msgstr "Gnlk Kayd Se軻nekleri" +msgstr "Gテシnlテシk Kaydトア Seテァenekleri" #: ../param/loadparm.c:874 msgid "Protocol Options" -msgstr "Protokol Se軻nekleri" +msgstr "Protokol Seテァenekleri" #: ../param/loadparm.c:911 msgid "Tuning Options" -msgstr "Ayar Se軻nekleri" +msgstr "Ayar Seテァenekleri" #: ../param/loadparm.c:940 msgid "Printing Options" -msgstr "Yazdrma Se軻nekleri" +msgstr "Yazdトアrma Seテァenekleri" #: ../param/loadparm.c:970 msgid "Filename Handling" -msgstr "Dosyaad ンlenmesi" +msgstr "Dosyaadトア トーナ殕enmesi" #: ../param/loadparm.c:996 msgid "Domain Options" -msgstr "Alan Se軻nekleri" +msgstr "Alan Seテァenekleri" #: ../param/loadparm.c:1000 msgid "Logon Options" -msgstr "Sistem Giri Se軻nekleri" +msgstr "Sistem Giriナ Seテァenekleri" #: ../param/loadparm.c:1019 msgid "Browse Options" -msgstr "Gzatma Se軻nekleri" +msgstr "Gテカzatma Seテァenekleri" #: ../param/loadparm.c:1033 msgid "WINS Options" -msgstr "WINS Se軻nekleri" +msgstr "WINS Seテァenekleri" #: ../param/loadparm.c:1043 msgid "Locking Options" -msgstr "Kilitleme Se軻nekleri" +msgstr "Kilitleme Seテァenekleri" #: ../param/loadparm.c:1061 msgid "Ldap Options" -msgstr "Ldap Se軻nekleri" +msgstr "Ldap Seテァenekleri" #: ../param/loadparm.c:1078 msgid "Miscellaneous Options" -msgstr "Dier Se軻nekler" +msgstr "Diト歹r Seテァenekler" #: ../param/loadparm.c:1138 msgid "VFS module options" -msgstr "VFS Se軻nekleri" +msgstr "VFS Seテァenekleri" #: ../param/loadparm.c:1148 msgid "Winbind options" -msgstr "Winbind se軻nekleri" +msgstr "Winbind seテァenekleri" diff --git a/source/printing/lpq_parse.c b/source/printing/lpq_parse.c index b7e41964f1b..68c06ade41f 100644 --- a/source/printing/lpq_parse.c +++ b/source/printing/lpq_parse.c @@ -921,13 +921,13 @@ static BOOL parse_lpq_vlp(char *line,print_queue_struct *buf,BOOL first) parse a lpq line. Choose printing style ****************************************************************************/ -BOOL parse_lpq_entry(int snum,char *line, +BOOL parse_lpq_entry(enum printing_types printing_type,char *line, print_queue_struct *buf, print_status_struct *status,BOOL first) { BOOL ret; - switch (lp_printing(snum)) + switch (printing_type) { case PRINT_SYSV: ret = parse_lpq_sysv(line,buf,first); @@ -971,7 +971,7 @@ BOOL parse_lpq_entry(int snum,char *line, } /* in the LPRNG case, we skip lines starting by a space.*/ - if (line && !ret && (lp_printing(snum)==PRINT_LPRNG) ) + if (line && !ret && (printing_type==PRINT_LPRNG) ) { if (line[0]==' ') return ret; diff --git a/source/printing/notify.c b/source/printing/notify.c index 10b5f745287..77326bee3e4 100644 --- a/source/printing/notify.c +++ b/source/printing/notify.c @@ -297,7 +297,7 @@ to notify_queue_head\n", msg->type, msg->field, msg->printer)); num_messages++; } -static void send_notify_field_values(const char *printer_name, uint32 type, +static void send_notify_field_values(const char *sharename, uint32 type, uint32 field, uint32 id, uint32 value1, uint32 value2, uint32 flags) { @@ -315,7 +315,7 @@ static void send_notify_field_values(const char *printer_name, uint32 type, ZERO_STRUCTP(msg); - fstrcpy(msg->printer, printer_name); + fstrcpy(msg->printer, sharename); msg->type = type; msg->field = field; msg->id = id; @@ -326,7 +326,7 @@ static void send_notify_field_values(const char *printer_name, uint32 type, send_spoolss_notify2_msg(msg); } -static void send_notify_field_buffer(const char *printer_name, uint32 type, +static void send_notify_field_buffer(const char *sharename, uint32 type, uint32 field, uint32 id, uint32 len, char *buffer) { @@ -344,7 +344,7 @@ static void send_notify_field_buffer(const char *printer_name, uint32 type, ZERO_STRUCTP(msg); - fstrcpy(msg->printer, printer_name); + fstrcpy(msg->printer, sharename); msg->type = type; msg->field = field; msg->id = id; @@ -356,140 +356,131 @@ static void send_notify_field_buffer(const char *printer_name, uint32 type, /* Send a message that the printer status has changed */ -void notify_printer_status_byname(const char *printer_name, uint32 status) +void notify_printer_status_byname(const char *sharename, uint32 status) { /* Printer status stored in value1 */ - send_notify_field_values(printer_name, PRINTER_NOTIFY_TYPE, + send_notify_field_values(sharename, PRINTER_NOTIFY_TYPE, PRINTER_NOTIFY_STATUS, 0, status, 0, 0); } void notify_printer_status(int snum, uint32 status) { - const char *printer_name = SERVICE(snum); + const char *sharename = SERVICE(snum); - if (printer_name) - notify_printer_status_byname(printer_name, status); + if (sharename) + notify_printer_status_byname(sharename, status); } -void notify_job_status_byname(const char *printer_name, uint32 jobid, uint32 status, +void notify_job_status_byname(const char *sharename, uint32 jobid, uint32 status, uint32 flags) { /* Job id stored in id field, status in value1 */ - send_notify_field_values(printer_name, JOB_NOTIFY_TYPE, + send_notify_field_values(sharename, JOB_NOTIFY_TYPE, JOB_NOTIFY_STATUS, jobid, status, 0, flags); } -void notify_job_status(int snum, uint32 jobid, uint32 status) +void notify_job_status(const char *sharename, uint32 jobid, uint32 status) { - const char *printer_name = SERVICE(snum); - - notify_job_status_byname(printer_name, jobid, status, 0); + notify_job_status_byname(sharename, jobid, status, 0); } -void notify_job_total_bytes(int snum, uint32 jobid, uint32 size) +void notify_job_total_bytes(const char *sharename, uint32 jobid, + uint32 size) { - const char *printer_name = SERVICE(snum); - /* Job id stored in id field, status in value1 */ - send_notify_field_values(printer_name, JOB_NOTIFY_TYPE, + send_notify_field_values(sharename, JOB_NOTIFY_TYPE, JOB_NOTIFY_TOTAL_BYTES, jobid, size, 0, 0); } -void notify_job_total_pages(int snum, uint32 jobid, uint32 pages) +void notify_job_total_pages(const char *sharename, uint32 jobid, + uint32 pages) { - const char *printer_name = SERVICE(snum); - /* Job id stored in id field, status in value1 */ - send_notify_field_values(printer_name, JOB_NOTIFY_TYPE, + send_notify_field_values(sharename, JOB_NOTIFY_TYPE, JOB_NOTIFY_TOTAL_PAGES, jobid, pages, 0, 0); } -void notify_job_username(int snum, uint32 jobid, char *name) +void notify_job_username(const char *sharename, uint32 jobid, char *name) { - const char *printer_name = SERVICE(snum); - send_notify_field_buffer( - printer_name, JOB_NOTIFY_TYPE, JOB_NOTIFY_USER_NAME, + sharename, JOB_NOTIFY_TYPE, JOB_NOTIFY_USER_NAME, jobid, strlen(name) + 1, name); } -void notify_job_name(int snum, uint32 jobid, char *name) +void notify_job_name(const char *sharename, uint32 jobid, char *name) { - const char *printer_name = SERVICE(snum); - send_notify_field_buffer( - printer_name, JOB_NOTIFY_TYPE, JOB_NOTIFY_DOCUMENT, + sharename, JOB_NOTIFY_TYPE, JOB_NOTIFY_DOCUMENT, jobid, strlen(name) + 1, name); } -void notify_job_submitted(int snum, uint32 jobid, time_t submitted) +void notify_job_submitted(const char *sharename, uint32 jobid, + time_t submitted) { - const char *printer_name = SERVICE(snum); - send_notify_field_buffer( - printer_name, JOB_NOTIFY_TYPE, JOB_NOTIFY_SUBMITTED, + sharename, JOB_NOTIFY_TYPE, JOB_NOTIFY_SUBMITTED, jobid, sizeof(submitted), (char *)&submitted); } void notify_printer_driver(int snum, char *driver_name) { - const char *printer_name = SERVICE(snum); + const char *sharename = SERVICE(snum); send_notify_field_buffer( - printer_name, PRINTER_NOTIFY_TYPE, PRINTER_NOTIFY_DRIVER_NAME, + sharename, PRINTER_NOTIFY_TYPE, PRINTER_NOTIFY_DRIVER_NAME, snum, strlen(driver_name) + 1, driver_name); } void notify_printer_comment(int snum, char *comment) { - const char *printer_name = SERVICE(snum); + const char *sharename = SERVICE(snum); send_notify_field_buffer( - printer_name, PRINTER_NOTIFY_TYPE, PRINTER_NOTIFY_COMMENT, + sharename, PRINTER_NOTIFY_TYPE, PRINTER_NOTIFY_COMMENT, snum, strlen(comment) + 1, comment); } void notify_printer_sharename(int snum, char *share_name) { - const char *printer_name = SERVICE(snum); + const char *sharename = SERVICE(snum); send_notify_field_buffer( - printer_name, PRINTER_NOTIFY_TYPE, PRINTER_NOTIFY_SHARE_NAME, + sharename, PRINTER_NOTIFY_TYPE, PRINTER_NOTIFY_SHARE_NAME, snum, strlen(share_name) + 1, share_name); } void notify_printer_printername(int snum, char *printername) { - const char *printer_name = SERVICE(snum); + const char *sharename = SERVICE(snum); send_notify_field_buffer( - printer_name, PRINTER_NOTIFY_TYPE, PRINTER_NOTIFY_PRINTER_NAME, + sharename, PRINTER_NOTIFY_TYPE, PRINTER_NOTIFY_PRINTER_NAME, snum, strlen(printername) + 1, printername); } void notify_printer_port(int snum, char *port_name) { - const char *printer_name = SERVICE(snum); + const char *sharename = SERVICE(snum); send_notify_field_buffer( - printer_name, PRINTER_NOTIFY_TYPE, PRINTER_NOTIFY_PORT_NAME, + sharename, PRINTER_NOTIFY_TYPE, PRINTER_NOTIFY_PORT_NAME, snum, strlen(port_name) + 1, port_name); } void notify_printer_location(int snum, char *location) { - const char *printer_name = SERVICE(snum); + const char *sharename = SERVICE(snum); send_notify_field_buffer( - printer_name, PRINTER_NOTIFY_TYPE, PRINTER_NOTIFY_LOCATION, + sharename, PRINTER_NOTIFY_TYPE, PRINTER_NOTIFY_LOCATION, snum, strlen(location) + 1, location); } diff --git a/source/printing/nt_printing.c b/source/printing/nt_printing.c index 3d664d25b86..a69433df37f 100644 --- a/source/printing/nt_printing.c +++ b/source/printing/nt_printing.c @@ -210,6 +210,7 @@ struct table_node { #define SPL_ARCH_W32ALPHA "W32ALPHA" #define SPL_ARCH_W32PPC "W32PPC" #define SPL_ARCH_IA64 "IA64" +#define SPL_ARCH_X64 "x64" static const struct table_node archi_table[]= { @@ -219,6 +220,7 @@ static const struct table_node archi_table[]= { {"Windows NT Alpha_AXP", SPL_ARCH_W32ALPHA, 2 }, {"Windows NT PowerPC", SPL_ARCH_W32PPC, 2 }, {"Windows IA64", SPL_ARCH_IA64, 3 }, + {"Windows x64", SPL_ARCH_X64, 3 }, {NULL, "", -1 } }; @@ -378,9 +380,11 @@ BOOL nt_printing_init(void) msgs. This is done in claim_connection() */ - win_rc = check_published_printers(); - if (!W_ERROR_IS_OK(win_rc)) - DEBUG(0, ("nt_printing_init: error checking published printers: %s\n", dos_errstr(win_rc))); + if ( lp_security() == SEC_ADS ) { + win_rc = check_published_printers(); + if (!W_ERROR_IS_OK(win_rc)) + DEBUG(0, ("nt_printing_init: error checking published printers: %s\n", dos_errstr(win_rc))); + } return True; } @@ -3270,7 +3274,7 @@ static void map_to_os2_driver(fstring drivername) /**************************************************************************** Get a default printer info 2 struct. ****************************************************************************/ -static WERROR get_a_printer_2_default(NT_PRINTER_INFO_LEVEL_2 **info_ptr, const char *sharename) +static WERROR get_a_printer_2_default(NT_PRINTER_INFO_LEVEL_2 **info_ptr, const char *servername, const char* sharename) { int snum; NT_PRINTER_INFO_LEVEL_2 info; @@ -3279,9 +3283,9 @@ static WERROR get_a_printer_2_default(NT_PRINTER_INFO_LEVEL_2 **info_ptr, const snum = lp_servicenumber(sharename); - slprintf(info.servername, sizeof(info.servername)-1, "\\\\%s", get_called_name()); + slprintf(info.servername, sizeof(info.servername)-1, "\\\\%s", servername); slprintf(info.printername, sizeof(info.printername)-1, "\\\\%s\\%s", - get_called_name(), sharename); + servername, sharename); fstrcpy(info.sharename, sharename); fstrcpy(info.portname, SAMBA_PRINTER_PORT_NAME); @@ -3349,11 +3353,12 @@ static WERROR get_a_printer_2_default(NT_PRINTER_INFO_LEVEL_2 **info_ptr, const /**************************************************************************** ****************************************************************************/ -static WERROR get_a_printer_2(NT_PRINTER_INFO_LEVEL_2 **info_ptr, const char *sharename) +static WERROR get_a_printer_2(NT_PRINTER_INFO_LEVEL_2 **info_ptr, const char *servername, const char *sharename) { pstring key; NT_PRINTER_INFO_LEVEL_2 info; - int len = 0; + int len = 0; + int snum = lp_servicenumber(sharename); TDB_DATA kbuf, dbuf; fstring printername; char adevice[MAXDEVICENAME]; @@ -3367,7 +3372,7 @@ static WERROR get_a_printer_2(NT_PRINTER_INFO_LEVEL_2 **info_ptr, const char *sh dbuf = tdb_fetch(tdb_printers, kbuf); if (!dbuf.dptr) - return get_a_printer_2_default(info_ptr, sharename); + return get_a_printer_2_default(info_ptr, servername, sharename); len += tdb_unpack(dbuf.dptr+len, dbuf.dsize-len, "dddddddddddfffffPfffff", &info.attributes, @@ -3398,9 +3403,13 @@ static WERROR get_a_printer_2(NT_PRINTER_INFO_LEVEL_2 **info_ptr, const char *sh info.attributes &= ~PRINTER_ATTRIBUTE_NOT_SAMBA; /* Restore the stripped strings. */ - slprintf(info.servername, sizeof(info.servername)-1, "\\\\%s", get_called_name()); - slprintf(printername, sizeof(printername)-1, "\\\\%s\\%s", get_called_name(), - info.printername); + slprintf(info.servername, sizeof(info.servername)-1, "\\\\%s", servername); + + if ( lp_force_printername(snum) ) + slprintf(printername, sizeof(printername)-1, "\\\\%s\\%s", servername, sharename ); + else + slprintf(printername, sizeof(printername)-1, "\\\\%s\\%s", servername, info.printername); + fstrcpy(info.printername, printername); len += unpack_devicemode(&info.devmode,dbuf.dptr+len, dbuf.dsize-len); @@ -3413,7 +3422,7 @@ static WERROR get_a_printer_2(NT_PRINTER_INFO_LEVEL_2 **info_ptr, const char *sh * See comments in get_a_printer_2_default() */ - if (lp_default_devmode(lp_servicenumber(sharename)) && !info.devmode) { + if (lp_default_devmode(snum) && !info.devmode) { DEBUG(8,("get_a_printer_2: Constructing a default device mode for [%s]\n", printername)); info.devmode = construct_nt_devicemode(printername); @@ -3775,7 +3784,7 @@ static uint32 update_driver_init_2(NT_PRINTER_INFO_LEVEL_2 *info) len += pack_values( &info->data, buf+len, buflen-len ); - if (buflen != len) { + if (buflen < len) { char *tb; tb = (char *)Realloc(buf, len); @@ -4059,6 +4068,7 @@ WERROR get_a_printer( Printer_entry *print_hnd, NT_PRINTER_INFO_LEVEL **pp_print { WERROR result; NT_PRINTER_INFO_LEVEL *printer = NULL; + fstring servername; *pp_printer = NULL; @@ -4071,6 +4081,13 @@ WERROR get_a_printer( Printer_entry *print_hnd, NT_PRINTER_INFO_LEVEL **pp_print return WERR_NOMEM; } ZERO_STRUCTP(printer); + + if ( print_hnd ) + fstrcpy( servername, print_hnd->servername ); + else { + fstrcpy( servername, "%L" ); + standard_sub_basic( "", servername, sizeof(servername)-1 ); + } /* * check for cache first. A Printer handle cannot changed @@ -4105,12 +4122,12 @@ WERROR get_a_printer( Printer_entry *print_hnd, NT_PRINTER_INFO_LEVEL **pp_print Make sure to use a short lived talloc ctx */ if ( print_hnd ) - result = find_printer_in_print_hnd_cache(get_talloc_ctx(), &printer->info_2, sharename); + result = find_printer_in_print_hnd_cache(get_talloc_ctx(), &printer->info_2, servername, sharename); /* fail to disk if we don't have it with any open handle */ if ( !print_hnd || !W_ERROR_IS_OK(result) ) - result = get_a_printer_2(&printer->info_2, sharename); + result = get_a_printer_2(&printer->info_2, servername, sharename ); /* we have a new printer now. Save it with this handle */ @@ -5116,3 +5133,11 @@ BOOL print_time_access_check(int snum) return ok; } + +/**************************************************************************** + Fill in the servername sent in the _spoolss_open_printer_ex() call +****************************************************************************/ +char* get_server_name( Printer_entry *printer ) +{ + return printer->servername; +} diff --git a/source/printing/print_cups.c b/source/printing/print_cups.c index 3097811fac2..ad01a68c8e6 100644 --- a/source/printing/print_cups.c +++ b/source/printing/print_cups.c @@ -27,31 +27,6 @@ /* - * CUPS printing interface definitions... - */ - -static int cups_job_delete(int snum, struct printjob *pjob); -static int cups_job_pause(int snum, struct printjob *pjob); -static int cups_job_resume(int snum, struct printjob *pjob); -static int cups_job_submit(int snum, struct printjob *pjob); -static int cups_queue_get(int snum, print_queue_struct **q, - print_status_struct *status); -static int cups_queue_pause(int snum); -static int cups_queue_resume(int snum); - - -struct printif cups_printif = - { - cups_queue_get, - cups_queue_pause, - cups_queue_resume, - cups_job_delete, - cups_job_pause, - cups_job_resume, - cups_job_submit, - }; - -/* * 'cups_passwd_cb()' - The CUPS password callback... */ @@ -811,7 +786,11 @@ cups_job_submit(int snum, struct printjob *pjob) */ static int -cups_queue_get(int snum, print_queue_struct **q, print_status_struct *status) +cups_queue_get(const char *printer_name, + enum printing_types printing_type, + char *lpq_command, + print_queue_struct **q, + print_status_struct *status) { http_t *http; /* HTTP connection to server */ ipp_t *request, /* IPP Request */ @@ -847,7 +826,7 @@ cups_queue_get(int snum, print_queue_struct **q, print_status_struct *status) }; - DEBUG(5,("cups_queue_get(%d, %p, %p)\n", snum, q, status)); + DEBUG(5,("cups_queue_get(%s, %p, %p)\n", printer_name, q, status)); /* * Make sure we don't ask for passwords... @@ -870,8 +849,7 @@ cups_queue_get(int snum, print_queue_struct **q, print_status_struct *status) * Generate the printer URI... */ - slprintf(uri, sizeof(uri) - 1, "ipp://localhost/printers/%s", - PRINTERNAME(snum)); + slprintf(uri, sizeof(uri) - 1, "ipp://localhost/printers/%s", printer_name); /* * Build an IPP_GET_JOBS request, which requires the following @@ -1090,7 +1068,7 @@ cups_queue_get(int snum, print_queue_struct **q, print_status_struct *status) if ((response = cupsDoRequest(http, request, "/")) == NULL) { - DEBUG(0,("Unable to get printer status for %s - %s\n", PRINTERNAME(snum), + DEBUG(0,("Unable to get printer status for %s - %s\n", printer_name, ippErrorString(cupsLastError()))); httpClose(http); *q = queue; @@ -1099,7 +1077,7 @@ cups_queue_get(int snum, print_queue_struct **q, print_status_struct *status) if (response->request.status.status_code >= IPP_OK_CONFLICT) { - DEBUG(0,("Unable to get printer status for %s - %s\n", PRINTERNAME(snum), + DEBUG(0,("Unable to get printer status for %s - %s\n", printer_name, ippErrorString(response->request.status.status_code))); ippDelete(response); httpClose(http); @@ -1319,6 +1297,21 @@ cups_queue_resume(int snum) return (ret); } +/******************************************************************* + * CUPS printing interface definitions... + ******************************************************************/ + +struct printif cups_printif = +{ + PRINT_CUPS, + cups_queue_get, + cups_queue_pause, + cups_queue_resume, + cups_job_delete, + cups_job_pause, + cups_job_resume, + cups_job_submit, +}; #else /* this keeps fussy compilers happy */ diff --git a/source/printing/print_generic.c b/source/printing/print_generic.c index 9e0ea85bb9a..d6074704b3f 100644 --- a/source/printing/print_generic.c +++ b/source/printing/print_generic.c @@ -22,37 +22,12 @@ #include "printing.h" -/* - * Generic printing interface definitions... - */ - -static int generic_job_delete(int snum, struct printjob *pjob); -static int generic_job_pause(int snum, struct printjob *pjob); -static int generic_job_resume(int snum, struct printjob *pjob); -static int generic_job_submit(int snum, struct printjob *pjob); -static int generic_queue_get(int snum, print_queue_struct **q, - print_status_struct *status); -static int generic_queue_pause(int snum); -static int generic_queue_resume(int snum); - - -struct printif generic_printif = - { - generic_queue_get, - generic_queue_pause, - generic_queue_resume, - generic_job_delete, - generic_job_pause, - generic_job_resume, - generic_job_submit, - }; - /**************************************************************************** run a given print command a null terminated list of value/substitute pairs is provided for local substitution strings ****************************************************************************/ -static int print_run_command(int snum,char *command, int *outfd, ...) +static int print_run_command(int snum, const char* printername, BOOL do_sub, char *command, int *outfd, ...) { pstring syscmd; @@ -61,12 +36,13 @@ static int print_run_command(int snum,char *command, int *outfd, ...) va_list ap; va_start(ap, outfd); - if (!command || !*command) return -1; + /* check for a valid system printername and valid command to run */ - if (!VALID_SNUM(snum)) { - DEBUG(0,("Invalid snum %d for command %s\n", snum, command)); + if ( !printername || !*printername ) + return -1; + + if (!command || !*command) return -1; - } pstrcpy(syscmd, command); @@ -76,9 +52,11 @@ static int print_run_command(int snum,char *command, int *outfd, ...) } va_end(ap); - pstring_sub(syscmd, "%p", PRINTERNAME(snum)); - standard_sub_snum(snum,syscmd,sizeof(syscmd)); + pstring_sub( syscmd, "%p", printername ); + if ( do_sub && snum != -1 ) + standard_sub_snum(snum,syscmd,sizeof(syscmd)); + ret = smbrun(syscmd,outfd); DEBUG(3,("Running the command `%s' gave %d\n",syscmd,ret)); @@ -96,8 +74,7 @@ static int generic_job_delete(int snum, struct printjob *pjob) /* need to delete the spooled entry */ slprintf(jobstr, sizeof(jobstr)-1, "%d", pjob->sysjob); - return print_run_command( - snum, + return print_run_command(snum, PRINTERNAME(snum), True, lp_lprmcommand(snum), NULL, "%j", jobstr, "%T", http_timestring(pjob->starttime), @@ -113,7 +90,7 @@ static int generic_job_pause(int snum, struct printjob *pjob) /* need to pause the spooled entry */ slprintf(jobstr, sizeof(jobstr)-1, "%d", pjob->sysjob); - return print_run_command(snum, + return print_run_command(snum, PRINTERNAME(snum), True, lp_lppausecommand(snum), NULL, "%j", jobstr, NULL); @@ -128,7 +105,7 @@ static int generic_job_resume(int snum, struct printjob *pjob) /* need to pause the spooled entry */ slprintf(jobstr, sizeof(jobstr)-1, "%d", pjob->sysjob); - return print_run_command(snum, + return print_run_command(snum, PRINTERNAME(snum), True, lp_lpresumecommand(snum), NULL, "%j", jobstr, NULL); @@ -168,7 +145,7 @@ static int generic_job_submit(int snum, struct printjob *pjob) slprintf(job_size, sizeof(job_size)-1, "%lu", (unsigned long)pjob->size); /* send it to the system spooler */ - ret = print_run_command(snum, + ret = print_run_command(snum, PRINTERNAME(snum), True, lp_printcommand(snum), NULL, "%s", p, "%J", jobname, @@ -186,17 +163,22 @@ static int generic_job_submit(int snum, struct printjob *pjob) /**************************************************************************** get the current list of queued jobs ****************************************************************************/ -static int generic_queue_get(int snum, print_queue_struct **q, print_status_struct *status) +static int generic_queue_get(const char *printer_name, + enum printing_types printing_type, + char *lpq_command, + print_queue_struct **q, + print_status_struct *status) { char **qlines; int fd; int numlines, i, qcount; print_queue_struct *queue = NULL; - fstring printer_name; - - fstrcpy(printer_name, lp_servicename(snum)); - print_run_command(snum, lp_lpqcommand(snum), &fd, NULL); + /* never do substitution when running the 'lpq command' since we can't + get it rigt when using the background update daemon. Make the caller + do it before passing off the command string to us here. */ + + print_run_command(-1, printer_name, False, lpq_command, &fd, NULL); if (fd == -1) { DEBUG(5,("generic_queue_get: Can't read print queue status for printer %s\n", @@ -218,7 +200,7 @@ static int generic_queue_get(int snum, print_queue_struct **q, print_status_stru memset(queue, '\0', sizeof(print_queue_struct)*(numlines+1)); for (i=0; i<numlines; i++) { /* parse the line */ - if (parse_lpq_entry(snum,qlines[i], + if (parse_lpq_entry(printing_type,qlines[i], &queue[qcount],status,qcount==0)) { qcount++; } @@ -235,7 +217,7 @@ static int generic_queue_get(int snum, print_queue_struct **q, print_status_stru ****************************************************************************/ static int generic_queue_pause(int snum) { - return print_run_command(snum, lp_queuepausecommand(snum), NULL, NULL); + return print_run_command(snum, PRINTERNAME(snum), True, lp_queuepausecommand(snum), NULL, NULL); } /**************************************************************************** @@ -243,5 +225,22 @@ static int generic_queue_pause(int snum) ****************************************************************************/ static int generic_queue_resume(int snum) { - return print_run_command(snum, lp_queueresumecommand(snum), NULL, NULL); + return print_run_command(snum, PRINTERNAME(snum), True, lp_queueresumecommand(snum), NULL, NULL); } + +/**************************************************************************** + * Generic printing interface definitions... + ***************************************************************************/ + +struct printif generic_printif = +{ + DEFAULT_PRINTING, + generic_queue_get, + generic_queue_pause, + generic_queue_resume, + generic_job_delete, + generic_job_pause, + generic_job_resume, + generic_job_submit, +}; + diff --git a/source/printing/printfsp.c b/source/printing/printfsp.c index 0b6d4fdbe1c..7c5de468701 100644 --- a/source/printing/printfsp.c +++ b/source/printing/printfsp.c @@ -53,16 +53,16 @@ files_struct *print_fsp_open(connection_struct *conn, char *fname) } /* Convert to RAP id. */ - fsp->rap_print_jobid = pjobid_to_rap(SNUM(conn), jobid); + fsp->rap_print_jobid = pjobid_to_rap(lp_const_servicename(SNUM(conn)), jobid); if (fsp->rap_print_jobid == 0) { /* We need to delete the entry in the tdb. */ - pjob_delete(SNUM(conn), jobid); + pjob_delete(lp_const_servicename(SNUM(conn)), jobid); file_free(fsp); return NULL; } /* setup a full fsp */ - fsp->fd = print_job_fd(SNUM(conn),jobid); + fsp->fd = print_job_fd(lp_const_servicename(SNUM(conn)),jobid); GetTimeOfDay(&fsp->open_time); fsp->vuid = current_user.vuid; fsp->size = 0; @@ -77,7 +77,7 @@ files_struct *print_fsp_open(connection_struct *conn, char *fname) fsp->sent_oplock_break = NO_BREAK_SENT; fsp->is_directory = False; fsp->directory_delete_on_close = False; - string_set(&fsp->fsp_name,print_job_fname(SNUM(conn),jobid)); + string_set(&fsp->fsp_name,print_job_fname(lp_const_servicename(SNUM(conn)),jobid)); fsp->wbmpx_ptr = NULL; fsp->wcp = NULL; SMB_VFS_FSTAT(fsp,fsp->fd, &sbuf); @@ -96,7 +96,7 @@ print a file - called on closing the file void print_fsp_end(files_struct *fsp, BOOL normal_close) { uint32 jobid; - int snum; + fstring sharename; if (fsp->share_mode == FILE_DELETE_ON_CLOSE) { /* @@ -110,7 +110,7 @@ void print_fsp_end(files_struct *fsp, BOOL normal_close) string_free(&fsp->fsp_name); } - if (!rap_to_pjobid(fsp->rap_print_jobid, &snum, &jobid)) { + if (!rap_to_pjobid(fsp->rap_print_jobid, sharename, &jobid)) { DEBUG(3,("print_fsp_end: Unable to convert RAP jobid %u to print jobid.\n", (unsigned int)fsp->rap_print_jobid )); return; diff --git a/source/printing/printing.c b/source/printing/printing.c index 60adcc4d7f0..1e897c962a6 100644 --- a/source/printing/printing.c +++ b/source/printing/printing.c @@ -27,7 +27,7 @@ extern SIG_ATOMIC_T got_sig_term; extern SIG_ATOMIC_T reload_after_sighup; /* Current printer interface */ -static BOOL remove_from_jobs_changed(int snum, uint32 jobid); +static BOOL remove_from_jobs_changed(const char* sharename, uint32 jobid); /* the printing backend revolves around a tdb database that stores the @@ -50,12 +50,16 @@ static BOOL remove_from_jobs_changed(int snum, uint32 jobid); static TDB_CONTEXT *rap_tdb; static uint16 next_rap_jobid; +struct rap_jobid_key { + fstring sharename; + uint32 jobid; +}; -uint16 pjobid_to_rap(int snum, uint32 jobid) +uint16 pjobid_to_rap(const char* sharename, uint32 jobid) { uint16 rap_jobid; TDB_DATA data, key; - char jinfo[8]; + struct rap_jobid_key jinfo; DEBUG(10,("pjobid_to_rap: called.\n")); @@ -66,18 +70,18 @@ uint16 pjobid_to_rap(int snum, uint32 jobid) return 0; } - SIVAL(&jinfo,0,(int32)snum); - SIVAL(&jinfo,4,jobid); - - key.dptr = (char *)&jinfo; + ZERO_STRUCT( jinfo ); + fstrcpy( jinfo.sharename, sharename ); + jinfo.jobid = jobid; + key.dptr = (char*)&jinfo; key.dsize = sizeof(jinfo); + data = tdb_fetch(rap_tdb, key); if (data.dptr && data.dsize == sizeof(uint16)) { rap_jobid = SVAL(data.dptr, 0); SAFE_FREE(data.dptr); DEBUG(10,("pjobid_to_rap: jobid %u maps to RAP jobid %u\n", - (unsigned int)jobid, - (unsigned int)rap_jobid)); + (unsigned int)jobid, (unsigned int)rap_jobid)); return rap_jobid; } SAFE_FREE(data.dptr); @@ -91,12 +95,11 @@ uint16 pjobid_to_rap(int snum, uint32 jobid) tdb_store(rap_tdb, data, key, TDB_REPLACE); DEBUG(10,("pjobid_to_rap: created jobid %u maps to RAP jobid %u\n", - (unsigned int)jobid, - (unsigned int)rap_jobid)); + (unsigned int)jobid, (unsigned int)rap_jobid)); return rap_jobid; } -BOOL rap_to_pjobid(uint16 rap_jobid, int *psnum, uint32 *pjobid) +BOOL rap_to_pjobid(uint16 rap_jobid, fstring sharename, uint32 *pjobid) { TDB_DATA data, key; @@ -108,48 +111,50 @@ BOOL rap_to_pjobid(uint16 rap_jobid, int *psnum, uint32 *pjobid) key.dptr = (char *)&rap_jobid; key.dsize = sizeof(rap_jobid); data = tdb_fetch(rap_tdb, key); - if (data.dptr && data.dsize == 8) { - *psnum = IVAL(data.dptr,0); - *pjobid = IVAL(data.dptr,4); + if ( data.dptr && data.dsize == sizeof(struct rap_jobid_key) ) + { + struct rap_jobid_key *jinfo = (struct rap_jobid_key*)data.dptr; + fstrcpy( sharename, jinfo->sharename ); + *pjobid = jinfo->jobid; DEBUG(10,("rap_to_pjobid: jobid %u maps to RAP jobid %u\n", - (unsigned int)*pjobid, - (unsigned int)rap_jobid)); + (unsigned int)*pjobid, (unsigned int)rap_jobid)); SAFE_FREE(data.dptr); return True; } DEBUG(10,("rap_to_pjobid: Failed to lookup RAP jobid %u\n", - (unsigned int)rap_jobid)); + (unsigned int)rap_jobid)); SAFE_FREE(data.dptr); return False; } -static void rap_jobid_delete(int snum, uint32 jobid) +static void rap_jobid_delete(const char* sharename, uint32 jobid) { TDB_DATA key, data; uint16 rap_jobid; - char jinfo[8]; + struct rap_jobid_key jinfo; DEBUG(10,("rap_jobid_delete: called.\n")); if (!rap_tdb) return; - SIVAL(&jinfo,0,(int32)snum); - SIVAL(&jinfo,4,jobid); - - key.dptr = (char *)&jinfo; + ZERO_STRUCT( jinfo ); + fstrcpy( jinfo.sharename, sharename ); + jinfo.jobid = jobid; + key.dptr = (char*)&jinfo; key.dsize = sizeof(jinfo); + data = tdb_fetch(rap_tdb, key); if (!data.dptr || (data.dsize != sizeof(uint16))) { DEBUG(10,("rap_jobid_delete: cannot find jobid %u\n", - (unsigned int)jobid )); + (unsigned int)jobid )); SAFE_FREE(data.dptr); return; } DEBUG(10,("rap_jobid_delete: deleting jobid %u\n", - (unsigned int)jobid )); + (unsigned int)jobid )); rap_jobid = SVAL(data.dptr, 0); SAFE_FREE(data.dptr); @@ -159,7 +164,7 @@ static void rap_jobid_delete(int snum, uint32 jobid) tdb_delete(rap_tdb, data); } -static int get_queue_status(int, print_status_struct *); +static int get_queue_status(const char* sharename, print_status_struct *); /**************************************************************************** Initialise the printing backend. Called once at startup before the fork(). @@ -223,19 +228,27 @@ void printing_end(void) when asked for (and only when supported) ****************************************************************************/ -static struct printif *get_printer_fns( int snum ) +static struct printif *get_printer_fns_from_type( enum printing_types type ) { struct printif *printer_fns = &generic_printif; #ifdef HAVE_CUPS - if ( lp_printing(snum) == PRINT_CUPS ) { + if ( type == PRINT_CUPS ) { printer_fns = &cups_printif; } #endif /* HAVE_CUPS */ + + printer_fns->type = type; return printer_fns; } +static struct printif *get_printer_fns( int snum ) +{ + return get_printer_fns_from_type( lp_printing(snum) ); +} + + /**************************************************************************** Useful function to generate a tdb key. ****************************************************************************/ @@ -306,11 +319,11 @@ int unpack_pjob( char* buf, int buflen, struct printjob *pjob ) Useful function to find a print job in the database. ****************************************************************************/ -static struct printjob *print_job_find(int snum, uint32 jobid) +static struct printjob *print_job_find(const char *sharename, uint32 jobid) { static struct printjob pjob; TDB_DATA ret; - struct tdb_print_db *pdb = get_print_db_byname(lp_const_servicename(snum)); + struct tdb_print_db *pdb = get_print_db_byname(sharename); if (!pdb) @@ -427,7 +440,7 @@ static uint32 map_to_spoolss_status(uint32 lpq_status) return 0; } -static void pjob_store_notify(int snum, uint32 jobid, struct printjob *old_data, +static void pjob_store_notify(const char* sharename, uint32 jobid, struct printjob *old_data, struct printjob *new_data) { BOOL new_job = False; @@ -446,38 +459,38 @@ static void pjob_store_notify(int snum, uint32 jobid, struct printjob *old_data, --jerry (i'll feel dirty for this) */ if (new_job) { - notify_job_submitted(snum, jobid, new_data->starttime); - notify_job_username(snum, jobid, new_data->user); + notify_job_submitted(sharename, jobid, new_data->starttime); + notify_job_username(sharename, jobid, new_data->user); } if (new_job || !strequal(old_data->jobname, new_data->jobname)) - notify_job_name(snum, jobid, new_data->jobname); + notify_job_name(sharename, jobid, new_data->jobname); /* Job attributes of a new job or attributes that can be modified. */ if (new_job || !strequal(old_data->jobname, new_data->jobname)) - notify_job_name(snum, jobid, new_data->jobname); + notify_job_name(sharename, jobid, new_data->jobname); if (new_job || old_data->status != new_data->status) - notify_job_status(snum, jobid, map_to_spoolss_status(new_data->status)); + notify_job_status(sharename, jobid, map_to_spoolss_status(new_data->status)); if (new_job || old_data->size != new_data->size) - notify_job_total_bytes(snum, jobid, new_data->size); + notify_job_total_bytes(sharename, jobid, new_data->size); if (new_job || old_data->page_count != new_data->page_count) - notify_job_total_pages(snum, jobid, new_data->page_count); + notify_job_total_pages(sharename, jobid, new_data->page_count); } /**************************************************************************** Store a job structure back to the database. ****************************************************************************/ -static BOOL pjob_store(int snum, uint32 jobid, struct printjob *pjob) +static BOOL pjob_store(const char* sharename, uint32 jobid, struct printjob *pjob) { TDB_DATA old_data, new_data; BOOL ret = False; - struct tdb_print_db *pdb = get_print_db_byname(lp_const_servicename(snum)); + struct tdb_print_db *pdb = get_print_db_byname(sharename); char *buf = NULL; int len, newlen, buflen; @@ -545,13 +558,13 @@ static BOOL pjob_store(int snum, uint32 jobid, struct printjob *pjob) { if ( unpack_pjob( old_data.dptr, old_data.dsize, &old_pjob ) != -1 ) { - pjob_store_notify( snum, jobid, &old_pjob , pjob ); + pjob_store_notify( sharename, jobid, &old_pjob , pjob ); free_nt_devicemode( &old_pjob.nt_devmode ); } } else { /* new job */ - pjob_store_notify( snum, jobid, NULL, pjob ); + pjob_store_notify( sharename, jobid, NULL, pjob ); } } @@ -566,15 +579,19 @@ done: Remove a job structure from the database. ****************************************************************************/ -void pjob_delete(int snum, uint32 jobid) +void pjob_delete(const char* sharename, uint32 jobid) { - struct printjob *pjob = print_job_find(snum, jobid); + struct printjob *pjob; uint32 job_status = 0; - struct tdb_print_db *pdb = get_print_db_byname(lp_const_servicename(snum)); + struct tdb_print_db *pdb; + + pdb = get_print_db_byname( sharename ); if (!pdb) return; + pjob = print_job_find( sharename, jobid ); + if (!pjob) { DEBUG(5, ("pjob_delete: we were asked to delete nonexistent job %u\n", (unsigned int)jobid)); @@ -587,14 +604,14 @@ void pjob_delete(int snum, uint32 jobid) properly. */ job_status = JOB_STATUS_DELETING|JOB_STATUS_DELETED; - notify_job_status(snum, jobid, job_status); + notify_job_status(sharename, jobid, job_status); /* Remove from printing.tdb */ tdb_delete(pdb->tdb, print_key(jobid)); - remove_from_jobs_changed(snum, jobid); - release_print_db(pdb); - rap_jobid_delete(snum, jobid); + remove_from_jobs_changed(sharename, jobid); + release_print_db( pdb ); + rap_jobid_delete(sharename, jobid); } /**************************************************************************** @@ -620,7 +637,7 @@ static uint32 print_parse_jobid(char *fname) List a unix job in the print database. ****************************************************************************/ -static void print_unix_job(int snum, print_queue_struct *q, uint32 jobid) +static void print_unix_job(const char *sharename, print_queue_struct *q, uint32 jobid) { struct printjob pj, *old_pj; @@ -629,7 +646,7 @@ static void print_unix_job(int snum, print_queue_struct *q, uint32 jobid) /* Preserve the timestamp on an existing unix print job */ - old_pj = print_job_find(snum, jobid); + old_pj = print_job_find(sharename, jobid); ZERO_STRUCT(pj); @@ -649,15 +666,16 @@ static void print_unix_job(int snum, print_queue_struct *q, uint32 jobid) fstrcpy(pj.jobname, old_pj ? old_pj->jobname : q->fs_file); } fstrcpy(pj.user, old_pj ? old_pj->user : q->fs_user); - fstrcpy(pj.queuename, old_pj ? old_pj->queuename : lp_const_servicename(snum)); + fstrcpy(pj.queuename, old_pj ? old_pj->queuename : sharename ); - pjob_store(snum, jobid, &pj); + pjob_store(sharename, jobid, &pj); } struct traverse_struct { print_queue_struct *queue; int qcount, snum, maxcount, total_jobs; + const char *sharename; time_t lpq_time; }; @@ -681,11 +699,6 @@ static int traverse_fn_delete(TDB_CONTEXT *t, TDB_DATA key, TDB_DATA data, void free_nt_devicemode( &pjob.nt_devmode ); - if (ts->snum != lp_servicenumber(pjob.queuename)) { - /* this isn't for the queue we are looking at - this cannot happen with the split tdb's. JRA */ - return 0; - } - if (!pjob.smbjob) { /* remove a unix job if it isn't in the system queue any more */ @@ -697,7 +710,7 @@ static int traverse_fn_delete(TDB_CONTEXT *t, TDB_DATA key, TDB_DATA data, void if (i == ts->qcount) { DEBUG(10,("traverse_fn_delete: pjob %u deleted due to !smbjob\n", (unsigned int)jobid )); - pjob_delete(ts->snum, jobid); + pjob_delete(ts->sharename, jobid); return 0; } @@ -713,7 +726,7 @@ static int traverse_fn_delete(TDB_CONTEXT *t, TDB_DATA key, TDB_DATA data, void if (!process_exists(pjob.pid)) { DEBUG(10,("traverse_fn_delete: pjob %u deleted due to !process_exists (%u)\n", (unsigned int)jobid, (unsigned int)pjob.pid )); - pjob_delete(ts->snum, jobid); + pjob_delete(ts->sharename, jobid); } else ts->total_jobs++; return 0; @@ -746,7 +759,7 @@ static int traverse_fn_delete(TDB_CONTEXT *t, TDB_DATA key, TDB_DATA data, void (unsigned int)jobid, (unsigned int)pjob.starttime, (unsigned int)ts->lpq_time )); - pjob_delete(ts->snum, jobid); + pjob_delete(ts->sharename, jobid); } else ts->total_jobs++; return 0; @@ -776,12 +789,12 @@ static int traverse_fn_delete(TDB_CONTEXT *t, TDB_DATA key, TDB_DATA data, void static void print_cache_flush(int snum) { fstring key; - const char *printername = lp_const_servicename(snum); - struct tdb_print_db *pdb = get_print_db_byname(printername); + const char *sharename = lp_const_servicename(snum); + struct tdb_print_db *pdb = get_print_db_byname(sharename); if (!pdb) return; - slprintf(key, sizeof(key)-1, "CACHE/%s", printername); + slprintf(key, sizeof(key)-1, "CACHE/%s", sharename); tdb_store_int32(pdb->tdb, key, -1); release_print_db(pdb); } @@ -790,16 +803,16 @@ static void print_cache_flush(int snum) Check if someone already thinks they are doing the update. ****************************************************************************/ -static pid_t get_updating_pid(fstring printer_name) +static pid_t get_updating_pid(fstring sharename) { fstring keystr; TDB_DATA data, key; pid_t updating_pid; - struct tdb_print_db *pdb = get_print_db_byname(printer_name); + struct tdb_print_db *pdb = get_print_db_byname(sharename); if (!pdb) return (pid_t)-1; - slprintf(keystr, sizeof(keystr)-1, "UPDATING/%s", printer_name); + slprintf(keystr, sizeof(keystr)-1, "UPDATING/%s", sharename); key.dptr = keystr; key.dsize = strlen(keystr); @@ -824,7 +837,7 @@ static pid_t get_updating_pid(fstring printer_name) in the tdb. ****************************************************************************/ -static void set_updating_pid(const fstring printer_name, BOOL delete) +static void set_updating_pid(const fstring sharename, BOOL delete) { fstring keystr; TDB_DATA key; @@ -832,12 +845,12 @@ static void set_updating_pid(const fstring printer_name, BOOL delete) pid_t updating_pid = sys_getpid(); uint8 buffer[4]; - struct tdb_print_db *pdb = get_print_db_byname(printer_name); + struct tdb_print_db *pdb = get_print_db_byname(sharename); if (!pdb) return; - slprintf(keystr, sizeof(keystr)-1, "UPDATING/%s", printer_name); + slprintf(keystr, sizeof(keystr)-1, "UPDATING/%s", sharename); key.dptr = keystr; key.dsize = strlen(keystr); @@ -951,7 +964,7 @@ static TDB_DATA get_jobs_changed_data(struct tdb_print_db *pdb) return data; } -static void check_job_changed(int snum, TDB_DATA data, uint32 jobid) +static void check_job_changed(const char *sharename, TDB_DATA data, uint32 jobid) { unsigned int i; unsigned int job_count = data.dsize / 4; @@ -961,15 +974,23 @@ static void check_job_changed(int snum, TDB_DATA data, uint32 jobid) ch_jobid = IVAL(data.dptr, i*4); if (ch_jobid == jobid) - remove_from_jobs_changed(snum, jobid); + remove_from_jobs_changed(sharename, jobid); } } +struct print_queue_update_context { + fstring sharename; + enum printing_types printing_type; + pstring lpqcommand; +}; + /**************************************************************************** - Update the internal database from the system print queue for a queue. + main work for updating the lpq cahe for a printer queue ****************************************************************************/ -static void print_queue_update_internal(int snum) +static void print_queue_update_internal( const char *sharename, + struct printif *current_printif, + char *lpq_command ) { int i, qcount; print_queue_struct *queue = NULL; @@ -977,88 +998,35 @@ static void print_queue_update_internal(int snum) print_status_struct old_status; struct printjob *pjob; struct traverse_struct tstruct; - fstring keystr, printer_name, cachestr; TDB_DATA data, key; TDB_DATA jcdata; - struct tdb_print_db *pdb; - struct printif *current_printif = get_printer_fns( snum ); - - fstrcpy(printer_name, lp_const_servicename(snum)); - pdb = get_print_db_byname(printer_name); - if (!pdb) - return; - - /* - * Check to see if someone else is doing this update. - * This is essentially a mutex on the update. - */ - - if (get_updating_pid(printer_name) != -1) { - release_print_db(pdb); - return; - } - - /* Lock the queue for the database update */ - - slprintf(keystr, sizeof(keystr) - 1, "LOCK/%s", printer_name); - /* Only wait 10 seconds for this. */ - if (tdb_lock_bystring(pdb->tdb, keystr, 10) == -1) { - DEBUG(0,("print_queue_update: Failed to lock printer %s database\n", printer_name)); - release_print_db(pdb); - return; - } - - /* - * Ensure that no one else got in here. - * If the updating pid is still -1 then we are - * the winner. - */ - - if (get_updating_pid(printer_name) != -1) { - /* - * Someone else is doing the update, exit. - */ - tdb_unlock_bystring(pdb->tdb, keystr); - release_print_db(pdb); - return; - } - - /* - * We're going to do the update ourselves. - */ - - /* Tell others we're doing the update. */ - set_updating_pid(printer_name, False); - - /* - * Allow others to enter and notice we're doing - * the update. - */ - - tdb_unlock_bystring(pdb->tdb, keystr); - + fstring keystr, cachestr; + struct tdb_print_db *pdb = get_print_db_byname(sharename); + /* * Update the cache time FIRST ! Stops others even * attempting to get the lock and doing this * if the lpq takes a long time. */ - slprintf(cachestr, sizeof(cachestr)-1, "CACHE/%s", printer_name); + slprintf(cachestr, sizeof(cachestr)-1, "CACHE/%s", sharename); tdb_store_int32(pdb->tdb, cachestr, (int)time(NULL)); /* get the current queue using the appropriate interface */ ZERO_STRUCT(status); - qcount = (*(current_printif->queue_get))(snum, &queue, &status); + qcount = (*(current_printif->queue_get))(sharename, + current_printif->type, + lpq_command, &queue, &status); DEBUG(3, ("%d job%s in queue for %s\n", qcount, (qcount != 1) ? - "s" : "", printer_name)); + "s" : "", sharename)); /* Sort the queue by submission time otherwise they are displayed in hash order. */ qsort(queue, qcount, sizeof(print_queue_struct), - QSORT_CAST(printjob_comp)); + QSORT_CAST(printjob_comp)); /* any job in the internal database that is marked as spooled @@ -1078,24 +1046,24 @@ static void print_queue_update_internal(int snum) if (jobid == (uint32)-1) { /* assume its a unix print job */ - print_unix_job(snum, &queue[i], jobid); + print_unix_job(sharename, &queue[i], jobid); continue; } /* we have an active SMB print job - update its status */ - pjob = print_job_find(snum, jobid); + pjob = print_job_find(sharename, jobid); if (!pjob) { /* err, somethings wrong. Probably smbd was restarted with jobs in the queue. All we can do is treat them like unix jobs. Pity. */ - print_unix_job(snum, &queue[i], jobid); + print_unix_job(sharename, &queue[i], jobid); continue; } pjob->sysjob = queue[i].job; pjob->status = queue[i].status; - pjob_store(snum, jobid, pjob); - check_job_changed(snum, jcdata, jobid); + pjob_store(sharename, jobid, pjob); + check_job_changed(sharename, jcdata, jobid); } SAFE_FREE(jcdata.dptr); @@ -1104,9 +1072,10 @@ static void print_queue_update_internal(int snum) system queue */ tstruct.queue = queue; tstruct.qcount = qcount; - tstruct.snum = snum; + tstruct.snum = -1; tstruct.total_jobs = 0; tstruct.lpq_time = time(NULL); + tstruct.sharename = sharename; tdb_traverse(pdb->tdb, traverse_fn_delete, (void *)&tstruct); @@ -1116,17 +1085,17 @@ static void print_queue_update_internal(int snum) SAFE_FREE(tstruct.queue); DEBUG(10,("print_queue_update: printer %s INFO/total_jobs = %d\n", - printer_name, tstruct.total_jobs )); + sharename, tstruct.total_jobs )); tdb_store_int32(pdb->tdb, "INFO/total_jobs", tstruct.total_jobs); - get_queue_status(snum, &old_status); + get_queue_status(sharename, &old_status); if (old_status.qcount != qcount) DEBUG(10,("print_queue_update: queue status change %d jobs -> %d jobs for printer %s\n", - old_status.qcount, qcount, printer_name )); + old_status.qcount, qcount, sharename)); /* store the new queue status structure */ - slprintf(keystr, sizeof(keystr)-1, "STATUS/%s", printer_name); + slprintf(keystr, sizeof(keystr)-1, "STATUS/%s", sharename); key.dptr = keystr; key.dsize = strlen(keystr); @@ -1140,11 +1109,90 @@ static void print_queue_update_internal(int snum) * as little as possible... */ - slprintf(keystr, sizeof(keystr)-1, "CACHE/%s", printer_name); + slprintf(keystr, sizeof(keystr)-1, "CACHE/%s", sharename); tdb_store_int32(pdb->tdb, keystr, (int32)time(NULL)); +} + +/**************************************************************************** + Update the internal database from the system print queue for a queue. + obtain a lock on the print queue before proceeding (needed when mutiple + smbd processes maytry to update the lpq cache concurrently). +****************************************************************************/ + +static void print_queue_update_with_lock(int snum) +{ + fstring sharename, keystr; + pstring lpq_command; + struct tdb_print_db *pdb; + struct printif *current_printif = get_printer_fns( snum ); + + fstrcpy(sharename, lp_const_servicename(snum)); + pdb = get_print_db_byname(sharename); + if (!pdb) + return; + + /* + * Check to see if someone else is doing this update. + * This is essentially a mutex on the update. + */ + + if (get_updating_pid(sharename) != -1) { + release_print_db(pdb); + return; + } + + /* Lock the queue for the database update */ + + slprintf(keystr, sizeof(keystr) - 1, "LOCK/%s", sharename); + /* Only wait 10 seconds for this. */ + if (tdb_lock_bystring(pdb->tdb, keystr, 10) == -1) { + DEBUG(0,("print_queue_update: Failed to lock printer %s database\n", sharename)); + release_print_db(pdb); + return; + } + + /* + * Ensure that no one else got in here. + * If the updating pid is still -1 then we are + * the winner. + */ + + if (get_updating_pid(sharename) != -1) { + /* + * Someone else is doing the update, exit. + */ + tdb_unlock_bystring(pdb->tdb, keystr); + release_print_db(pdb); + return; + } + + /* + * We're going to do the update ourselves. + */ + + /* Tell others we're doing the update. */ + set_updating_pid(sharename, False); + + /* + * Allow others to enter and notice we're doing + * the update. + */ + + tdb_unlock_bystring(pdb->tdb, keystr); + + /* do the main work now */ + /* have to substitute any variables here since + print_queue_get_internal() will not */ + + pstrcpy( lpq_command, lp_lpqcommand(snum) ); + pstring_sub( lpq_command, "%p", PRINTERNAME(snum) ); + standard_sub_snum( snum, lpq_command, sizeof(lpq_command) ); + + print_queue_update_internal( sharename, current_printif, lpq_command ); + /* Delete our pid from the db. */ - set_updating_pid(printer_name, True); + set_updating_pid(sharename, True); release_print_db(pdb); } @@ -1153,9 +1201,17 @@ this is the receive function of the background lpq updater ****************************************************************************/ static void print_queue_receive(int msg_type, pid_t src, void *buf, size_t len) { - int snum; - snum=*((int *)buf); - print_queue_update_internal(snum); + struct print_queue_update_context *ctx; + + if (len != sizeof(struct print_queue_update_context)) { + DEBUG(1, ("Got invalid print queue update message\n")); + return; + } + + ctx = (struct print_queue_update_context*)buf; + print_queue_update_internal(ctx->sharename, + get_printer_fns_from_type(ctx->printing_type), + ctx->lpqcommand ); } static pid_t background_lpq_updater_pid = -1; @@ -1207,6 +1263,10 @@ void start_background_queue(void) DEBUG(10,("start_background_queue: background LPQ thread got a message\n")); message_dispatch(); + + /* process any pending print change notify messages */ + + print_notify_send_messages(0); } } } @@ -1216,19 +1276,28 @@ update the internal database from the system print queue for a queue ****************************************************************************/ static void print_queue_update(int snum) { + struct print_queue_update_context ctx; + /* - * Make sure that the backgroup queueu process exists. + * Make sure that the background queue process exists. * Otherwise just do the update ourselves */ if ( background_lpq_updater_pid != -1 ) { + fstrcpy(ctx.sharename, lp_const_servicename(snum)); + ctx.printing_type = lp_printing(snum); + + pstrcpy(ctx.lpqcommand, lp_lpqcommand(snum)); + pstring_sub( ctx.lpqcommand, "%p", PRINTERNAME(snum) ); + standard_sub_snum( snum, ctx.lpqcommand, sizeof(ctx.lpqcommand) ); + become_root(); message_send_pid(background_lpq_updater_pid, - MSG_PRINTER_UPDATE, &snum, sizeof(snum), + MSG_PRINTER_UPDATE, &ctx, sizeof(ctx), False); unbecome_root(); } else - print_queue_update_internal( snum ); + print_queue_update_with_lock( snum ); } /**************************************************************************** @@ -1416,9 +1485,9 @@ list for printer %s\n", printername)); Check if a jobid is valid. It is valid if it exists in the database. ****************************************************************************/ -BOOL print_job_exists(int snum, uint32 jobid) +BOOL print_job_exists(const char* sharename, uint32 jobid) { - struct tdb_print_db *pdb = get_print_db_byname(lp_const_servicename(snum)); + struct tdb_print_db *pdb = get_print_db_byname(sharename); BOOL ret; if (!pdb) @@ -1432,9 +1501,9 @@ BOOL print_job_exists(int snum, uint32 jobid) Give the fd used for a jobid. ****************************************************************************/ -int print_job_fd(int snum, uint32 jobid) +int print_job_fd(const char* sharename, uint32 jobid) { - struct printjob *pjob = print_job_find(snum, jobid); + struct printjob *pjob = print_job_find(sharename, jobid); if (!pjob) return -1; /* don't allow another process to get this info - it is meaningless */ @@ -1449,9 +1518,9 @@ int print_job_fd(int snum, uint32 jobid) has not been spooled. ****************************************************************************/ -char *print_job_fname(int snum, uint32 jobid) +char *print_job_fname(const char* sharename, uint32 jobid) { - struct printjob *pjob = print_job_find(snum, jobid); + struct printjob *pjob = print_job_find(sharename, jobid); if (!pjob || pjob->spooled || pjob->pid != sys_getpid()) return NULL; return pjob->filename; @@ -1464,9 +1533,9 @@ char *print_job_fname(int snum, uint32 jobid) has not been spooled. ****************************************************************************/ -NT_DEVICEMODE *print_job_devmode(int snum, uint32 jobid) +NT_DEVICEMODE *print_job_devmode(const char* sharename, uint32 jobid) { - struct printjob *pjob = print_job_find(snum, jobid); + struct printjob *pjob = print_job_find(sharename, jobid); if ( !pjob ) return NULL; @@ -1490,22 +1559,24 @@ BOOL print_job_set_place(int snum, uint32 jobid, int place) BOOL print_job_set_name(int snum, uint32 jobid, char *name) { - struct printjob *pjob = print_job_find(snum, jobid); + const char* sharename = lp_const_servicename(snum); + struct printjob *pjob; + + pjob = print_job_find(sharename, jobid); if (!pjob || pjob->pid != sys_getpid()) return False; fstrcpy(pjob->jobname, name); - return pjob_store(snum, jobid, pjob); + return pjob_store(sharename, jobid, pjob); } /*************************************************************************** Remove a jobid from the 'jobs changed' list. ***************************************************************************/ -static BOOL remove_from_jobs_changed(int snum, uint32 jobid) +static BOOL remove_from_jobs_changed(const char* sharename, uint32 jobid) { - const char *printername = lp_const_servicename(snum); - struct tdb_print_db *pdb = get_print_db_byname(printername); + struct tdb_print_db *pdb = get_print_db_byname(sharename); TDB_DATA data, key; size_t job_count, i; BOOL ret = False; @@ -1560,10 +1631,13 @@ static BOOL remove_from_jobs_changed(int snum, uint32 jobid) static BOOL print_job_delete1(int snum, uint32 jobid) { - struct printjob *pjob = print_job_find(snum, jobid); + const char* sharename = lp_const_servicename(snum); + struct printjob *pjob = print_job_find(sharename, jobid); int result = 0; struct printif *current_printif = get_printer_fns( snum ); + pjob = print_job_find(sharename, jobid); + if (!pjob) return False; @@ -1584,7 +1658,7 @@ static BOOL print_job_delete1(int snum, uint32 jobid) /* Set the tdb entry to be deleting. */ pjob->status = LPQ_DELETING; - pjob_store(snum, jobid, pjob); + pjob_store(sharename, jobid, pjob); if (pjob->spooled && pjob->sysjob != -1) result = (*(current_printif->job_delete))(snum, pjob); @@ -1593,13 +1667,12 @@ static BOOL print_job_delete1(int snum, uint32 jobid) been spooled. */ if (result == 0) { - const char *printername = lp_const_servicename(snum); - struct tdb_print_db *pdb = get_print_db_byname(printername); + struct tdb_print_db *pdb = get_print_db_byname(sharename); int njobs = 1; if (!pdb) return False; - pjob_delete(snum, jobid); + pjob_delete(sharename, jobid); /* Ensure we keep a rough count of the number of total jobs... */ tdb_change_int32_atomic(pdb->tdb, "INFO/total_jobs", &njobs, -1); release_print_db(pdb); @@ -1614,7 +1687,7 @@ static BOOL print_job_delete1(int snum, uint32 jobid) static BOOL is_owner(struct current_user *user, int snum, uint32 jobid) { - struct printjob *pjob = print_job_find(snum, jobid); + struct printjob *pjob = print_job_find(lp_const_servicename(snum), jobid); user_struct *vuser; if (!pjob || !user) @@ -1633,6 +1706,7 @@ static BOOL is_owner(struct current_user *user, int snum, uint32 jobid) BOOL print_job_delete(struct current_user *user, int snum, uint32 jobid, WERROR *errcode) { + const char* sharename = lp_const_servicename( snum ); BOOL owner, deleted; char *fname; @@ -1665,7 +1739,7 @@ pause, or resume print job. User name: %s. Printer name: %s.", * spool file & return. */ - if ( (fname = print_job_fname( snum, jobid )) != NULL ) + if ( (fname = print_job_fname( sharename, jobid )) != NULL ) { /* remove the spool file */ DEBUG(10,("print_job_delete: Removing spool file [%s]\n", fname )); @@ -1685,7 +1759,7 @@ pause, or resume print job. User name: %s. Printer name: %s.", print_queue_update(snum); - deleted = !print_job_exists(snum, jobid); + deleted = !print_job_exists(sharename, jobid); if ( !deleted ) *errcode = WERR_ACCESS_DENIED; @@ -1698,9 +1772,12 @@ pause, or resume print job. User name: %s. Printer name: %s.", BOOL print_job_pause(struct current_user *user, int snum, uint32 jobid, WERROR *errcode) { - struct printjob *pjob = print_job_find(snum, jobid); + const char* sharename = lp_const_servicename(snum); + struct printjob *pjob; int ret = -1; struct printif *current_printif = get_printer_fns( snum ); + + pjob = print_job_find(sharename, jobid); if (!pjob || !user) return False; @@ -1736,7 +1813,7 @@ pause, or resume print job. User name: %s. Printer name: %s.", /* Send a printer notify message */ - notify_job_status(snum, jobid, JOB_STATUS_PAUSED); + notify_job_status(sharename, jobid, JOB_STATUS_PAUSED); /* how do we tell if this succeeded? */ @@ -1749,9 +1826,12 @@ pause, or resume print job. User name: %s. Printer name: %s.", BOOL print_job_resume(struct current_user *user, int snum, uint32 jobid, WERROR *errcode) { - struct printjob *pjob = print_job_find(snum, jobid); + const char *sharename = lp_const_servicename(snum); + struct printjob *pjob; int ret; struct printif *current_printif = get_printer_fns( snum ); + + pjob = print_job_find(sharename, jobid); if (!pjob || !user) return False; @@ -1785,7 +1865,7 @@ pause, or resume print job. User name: %s. Printer name: %s.", /* Send a printer notify message */ - notify_job_status(snum, jobid, JOB_STATUS_QUEUED); + notify_job_status(sharename, jobid, JOB_STATUS_QUEUED); return True; } @@ -1796,8 +1876,11 @@ pause, or resume print job. User name: %s. Printer name: %s.", int print_job_write(int snum, uint32 jobid, const char *buf, int size) { + const char* sharename = lp_const_servicename(snum); int return_code; - struct printjob *pjob = print_job_find(snum, jobid); + struct printjob *pjob; + + pjob = print_job_find(sharename, jobid); if (!pjob) return -1; @@ -1808,7 +1891,7 @@ int print_job_write(int snum, uint32 jobid, const char *buf, int size) return_code = write(pjob->fd, buf, size); if (return_code>0) { pjob->size += size; - pjob_store(snum, jobid, pjob); + pjob_store(sharename, jobid, pjob); } return return_code; } @@ -1856,12 +1939,11 @@ static BOOL print_cache_expired(int snum) Get the queue status - do not update if db is out of date. ****************************************************************************/ -static int get_queue_status(int snum, print_status_struct *status) +static int get_queue_status(const char* sharename, print_status_struct *status) { fstring keystr; TDB_DATA data, key; - const char *printername = lp_const_servicename(snum); - struct tdb_print_db *pdb = get_print_db_byname(printername); + struct tdb_print_db *pdb = get_print_db_byname(sharename); int len; if (!pdb) @@ -1869,7 +1951,7 @@ static int get_queue_status(int snum, print_status_struct *status) if (status) { ZERO_STRUCTP(status); - slprintf(keystr, sizeof(keystr)-1, "STATUS/%s", printername); + slprintf(keystr, sizeof(keystr)-1, "STATUS/%s", sharename); key.dptr = keystr; key.dsize = strlen(keystr); data = tdb_fetch(pdb->tdb, key); @@ -1892,6 +1974,7 @@ static int get_queue_status(int snum, print_status_struct *status) int print_queue_length(int snum, print_status_struct *pstatus) { + const char* sharename = lp_const_servicename( snum ); print_status_struct status; int len; @@ -1901,7 +1984,7 @@ int print_queue_length(int snum, print_status_struct *pstatus) /* also fetch the queue status */ memset(&status, 0, sizeof(status)); - len = get_queue_status(snum, &status); + len = get_queue_status(sharename, &status); if (pstatus) *pstatus = status; @@ -1913,7 +1996,7 @@ int print_queue_length(int snum, print_status_struct *pstatus) Allocate a jobid. Hold the lock for as short a time as possible. ***************************************************************************/ -static BOOL allocate_print_jobid(struct tdb_print_db *pdb, int snum, const char *printername, uint32 *pjobid) +static BOOL allocate_print_jobid(struct tdb_print_db *pdb, int snum, const char *sharename, uint32 *pjobid) { int i; uint32 jobid; @@ -1923,14 +2006,14 @@ static BOOL allocate_print_jobid(struct tdb_print_db *pdb, int snum, const char for (i = 0; i < 3; i++) { /* Lock the database - only wait 20 seconds. */ if (tdb_lock_bystring(pdb->tdb, "INFO/nextjob", 20) == -1) { - DEBUG(0,("allocate_print_jobid: failed to lock printing database %s\n", printername )); + DEBUG(0,("allocate_print_jobid: failed to lock printing database %s\n", sharename)); return False; } if (!tdb_fetch_uint32(pdb->tdb, "INFO/nextjob", &jobid)) { if (tdb_error(pdb->tdb) != TDB_ERR_NOEXIST) { DEBUG(0, ("allocate_print_jobid: failed to fetch INFO/nextjob for print queue %s\n", - printername )); + sharename)); return False; } jobid = 0; @@ -1947,13 +2030,13 @@ static BOOL allocate_print_jobid(struct tdb_print_db *pdb, int snum, const char /* We've finished with the INFO/nextjob lock. */ tdb_unlock_bystring(pdb->tdb, "INFO/nextjob"); - if (!print_job_exists(snum, jobid)) + if (!print_job_exists(sharename, jobid)) break; } if (i > 2) { DEBUG(0, ("allocate_print_jobid: failed to allocate a print job for queue %s\n", - printername )); + sharename)); /* Probably full... */ errno = ENOSPC; return False; @@ -2005,8 +2088,8 @@ uint32 print_job_start(struct current_user *user, int snum, char *jobname, NT_DE char *path; struct printjob pjob; user_struct *vuser; - const char *printername = lp_const_servicename(snum); - struct tdb_print_db *pdb = get_print_db_byname(printername); + const char *sharename = lp_const_servicename(snum); + struct tdb_print_db *pdb = get_print_db_byname(sharename); int njobs; errno = 0; @@ -2051,16 +2134,16 @@ uint32 print_job_start(struct current_user *user, int snum, char *jobname, NT_DE /* Insure the maximum queue size is not violated */ if ((njobs = print_queue_length(snum,NULL)) > lp_maxprintjobs(snum)) { DEBUG(3, ("print_job_start: Queue %s number of jobs (%d) larger than max printjobs per queue (%d).\n", - printername, njobs, lp_maxprintjobs(snum) )); + sharename, njobs, lp_maxprintjobs(snum) )); release_print_db(pdb); errno = ENOSPC; return (uint32)-1; } DEBUG(10,("print_job_start: Queue %s number of jobs (%d), max printjobs = %d\n", - printername, njobs, lp_maxprintjobs(snum) )); + sharename, njobs, lp_maxprintjobs(snum) )); - if (!allocate_print_jobid(pdb, snum, printername, &jobid)) + if (!allocate_print_jobid(pdb, snum, sharename, &jobid)) goto fail; /* create the database entry */ @@ -2105,7 +2188,7 @@ to open spool file %s.\n", pjob.filename)); goto fail; } - pjob_store(snum, jobid, &pjob); + pjob_store(sharename, jobid, &pjob); /* Update the 'jobs changed' entry used by print_queue_status. */ add_to_jobs_changed(pdb, jobid); @@ -2119,7 +2202,7 @@ to open spool file %s.\n", pjob.filename)); fail: if (jobid != -1) - pjob_delete(snum, jobid); + pjob_delete(sharename, jobid); release_print_db(pdb); @@ -2133,7 +2216,10 @@ to open spool file %s.\n", pjob.filename)); void print_job_endpage(int snum, uint32 jobid) { - struct printjob *pjob = print_job_find(snum, jobid); + const char* sharename = lp_const_servicename(snum); + struct printjob *pjob; + + pjob = print_job_find(sharename, jobid); if (!pjob) return; /* don't allow another process to get this info - it is meaningless */ @@ -2141,7 +2227,7 @@ void print_job_endpage(int snum, uint32 jobid) return; pjob->page_count++; - pjob_store(snum, jobid, pjob); + pjob_store(sharename, jobid, pjob); } /**************************************************************************** @@ -2152,11 +2238,14 @@ void print_job_endpage(int snum, uint32 jobid) BOOL print_job_end(int snum, uint32 jobid, BOOL normal_close) { - struct printjob *pjob = print_job_find(snum, jobid); + const char* sharename = lp_const_servicename(snum); + struct printjob *pjob; int ret; SMB_STRUCT_STAT sbuf; struct printif *current_printif = get_printer_fns( snum ); + pjob = print_job_find(sharename, jobid); + if (!pjob) return False; @@ -2187,7 +2276,7 @@ BOOL print_job_end(int snum, uint32 jobid, BOOL normal_close) DEBUG(5,("print_job_end: canceling spool of %s (%s)\n", pjob->filename, pjob->size ? "deleted" : "zero length" )); unlink(pjob->filename); - pjob_delete(snum, jobid); + pjob_delete(sharename, jobid); return True; } @@ -2202,7 +2291,7 @@ BOOL print_job_end(int snum, uint32 jobid, BOOL normal_close) pjob->spooled = True; pjob->status = LPQ_QUEUED; - pjob_store(snum, jobid, pjob); + pjob_store(sharename, jobid, pjob); /* make sure the database is up to date */ if (print_cache_expired(snum)) @@ -2215,7 +2304,7 @@ fail: /* The print job was not succesfully started. Cleanup */ /* Still need to add proper error return propagation! 010122:JRR */ unlink(pjob->filename); - pjob_delete(snum, jobid); + pjob_delete(sharename, jobid); return False; } @@ -2234,6 +2323,7 @@ static BOOL get_stored_queue_info(struct tdb_print_db *pdb, int snum, int *pcoun uint32 i; int max_reported_jobs = lp_max_reported_jobs(snum); BOOL ret = False; + const char* sharename = lp_servicename(snum); /* make sure the database is up to date */ if (print_cache_expired(snum)) @@ -2300,10 +2390,10 @@ static BOOL get_stored_queue_info(struct tdb_print_db *pdb, int snum, int *pcoun jobid = IVAL(cgdata.dptr, i*4); DEBUG(5,("get_stored_queue_info: changed job = %u\n", (unsigned int)jobid)); - pjob = print_job_find(snum, jobid); + pjob = print_job_find(lp_const_servicename(snum), jobid); if (!pjob) { DEBUG(5,("get_stored_queue_info: failed to find changed job = %u\n", (unsigned int)jobid)); - remove_from_jobs_changed(snum, jobid); + remove_from_jobs_changed(sharename, jobid); continue; } @@ -2351,7 +2441,7 @@ int print_queue_status(int snum, { fstring keystr; TDB_DATA data, key; - const char *printername; + const char *sharename; struct tdb_print_db *pdb; int count = 0; @@ -2365,8 +2455,8 @@ int print_queue_status(int snum, return 0; *ppqueue = NULL; - printername = lp_const_servicename(snum); - pdb = get_print_db_byname(printername); + sharename = lp_const_servicename(snum); + pdb = get_print_db_byname(sharename); if (!pdb) return 0; @@ -2377,7 +2467,7 @@ int print_queue_status(int snum, */ ZERO_STRUCTP(status); - slprintf(keystr, sizeof(keystr)-1, "STATUS/%s", printername); + slprintf(keystr, sizeof(keystr)-1, "STATUS/%s", sharename); key.dptr = keystr; key.dsize = strlen(keystr); data = tdb_fetch(pdb->tdb, key); diff --git a/source/python/py_ntsec.c b/source/python/py_ntsec.c index 5ce5e8fc1be..907e9d08c1b 100644 --- a/source/python/py_ntsec.c +++ b/source/python/py_ntsec.c @@ -182,6 +182,10 @@ BOOL py_from_SECDESC(PyObject **dict, SEC_DESC *sd) PyDict_SetItemString(*dict, "revision", obj); Py_DECREF(obj); + obj = PyInt_FromLong(sd->type); + PyDict_SetItemString(*dict, "type", obj); + Py_DECREF(obj); + if (py_from_SID(&obj, sd->owner_sid)) { PyDict_SetItemString(*dict, "owner_sid", obj); Py_DECREF(obj); @@ -209,6 +213,7 @@ BOOL py_to_SECDESC(SEC_DESC **sd, PyObject *dict, TALLOC_CTX *mem_ctx) { PyObject *obj; uint16 revision; + uint16 type = SEC_DESC_SELF_RELATIVE; DOM_SID owner_sid, group_sid; SEC_ACL sacl, dacl; BOOL got_dacl = False, got_sacl = False; @@ -222,6 +227,12 @@ BOOL py_to_SECDESC(SEC_DESC **sd, PyObject *dict, TALLOC_CTX *mem_ctx) revision = PyInt_AsLong(obj); + if ((obj = PyDict_GetItemString(dict, "type"))) { + if (obj != Py_None) { + type = PyInt_AsLong(obj); + } + } + if ((obj = PyDict_GetItemString(dict, "owner_sid"))) { if (obj != Py_None) { @@ -276,7 +287,7 @@ BOOL py_to_SECDESC(SEC_DESC **sd, PyObject *dict, TALLOC_CTX *mem_ctx) { size_t sd_size; - *sd = make_sec_desc(mem_ctx, revision, SEC_DESC_SELF_RELATIVE, + *sd = make_sec_desc(mem_ctx, revision, type, got_owner_sid ? &owner_sid : NULL, got_group_sid ? &group_sid : NULL, got_sacl ? &sacl : NULL, diff --git a/source/python/py_smb.c b/source/python/py_smb.c index e5e65061965..1347f79a9b3 100644 --- a/source/python/py_smb.c +++ b/source/python/py_smb.c @@ -149,7 +149,8 @@ static PyObject *py_smb_nt_create_andx(PyObject *self, PyObject *args, cli_state_object *cli = (cli_state_object *)self; static char *kwlist[] = { "filename", "desired_access", "file_attributes", "share_access", - "create_disposition", NULL }; + "create_disposition", "create_options", + NULL }; char *filename; uint32 desired_access, file_attributes = 0, share_access = FILE_SHARE_READ | FILE_SHARE_WRITE, @@ -159,7 +160,7 @@ static PyObject *py_smb_nt_create_andx(PyObject *self, PyObject *args, /* Parse parameters */ if (!PyArg_ParseTupleAndKeywords( - args, kw, "si|iii", kwlist, &filename, &desired_access, + args, kw, "si|iiii", kwlist, &filename, &desired_access, &file_attributes, &share_access, &create_disposition, &create_options)) return NULL; diff --git a/source/python/samba/printerdata.py b/source/python/samba/printerdata.py index 0b53a3dfb52..81575fecb2d 100644 --- a/source/python/samba/printerdata.py +++ b/source/python/samba/printerdata.py @@ -62,4 +62,4 @@ class printerdata_ex: return self.hnd.getprinterdataex(self.key, key)['data'] def __getitem__(self, key): - return self.printerdata_ex_subkey(self.host, key, creds, access) + return self.printerdata_ex_subkey(self.host, key, self.creds, access) diff --git a/source/registry/reg_printing.c b/source/registry/reg_printing.c index e50a5f4d4fd..14eb57c6f2a 100644 --- a/source/registry/reg_printing.c +++ b/source/registry/reg_printing.c @@ -90,6 +90,8 @@ static int print_subpath_environments( char *key, REGSUBKEY_CTR *subkeys ) "Windows NT R4000", "Windows NT Alpha_AXP", "Windows NT PowerPC", + "Windows IA64", + "Windows x64", NULL }; fstring *drivers = NULL; int i, env_index, num_drivers; diff --git a/source/rpc_client/cli_srvsvc.c b/source/rpc_client/cli_srvsvc.c index f8580d0fe2e..da4721c2c7d 100644 --- a/source/rpc_client/cli_srvsvc.c +++ b/source/rpc_client/cli_srvsvc.c @@ -225,6 +225,94 @@ WERROR cli_srvsvc_net_share_enum(struct cli_state *cli, TALLOC_CTX *mem_ctx, return result; } +WERROR cli_srvsvc_net_share_get_info(struct cli_state *cli, + TALLOC_CTX *mem_ctx, + const char *sharename, + uint32 info_level, + SRV_SHARE_INFO *info) +{ + prs_struct qbuf, rbuf; + SRV_Q_NET_SHARE_GET_INFO q; + SRV_R_NET_SHARE_GET_INFO r; + WERROR result = W_ERROR(ERRgeneral); + + ZERO_STRUCT(q); + ZERO_STRUCT(r); + + /* Initialise parse structures */ + + prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL); + prs_init(&rbuf, 0, mem_ctx, UNMARSHALL); + + /* Initialise input parameters */ + + init_srv_q_net_share_get_info(&q, cli->srv_name_slash, sharename, + info_level); + + /* Marshall data and send request */ + + if (!srv_io_q_net_share_get_info("", &q, &qbuf, 0) || + !rpc_api_pipe_req(cli, SRV_NET_SHARE_GET_INFO, &qbuf, &rbuf)) + goto done; + + /* Unmarshall response */ + + if (!srv_io_r_net_share_get_info("", &r, &rbuf, 0)) + goto done; + + result = r.status; + + if (!W_ERROR_IS_OK(result)) + goto done; + + ZERO_STRUCTP(info); + + info->switch_value = info_level; + + switch(info_level) { + case 502: + { + SRV_SHARE_INFO_502 *info502 = &info->share.info502; + SH_INFO_502_STR *info502_str = &info502->info_502_str; + + char *s; + + info->share.info502 = r.info.share.info502; + + /* Duplicate strings */ + + s = unistr2_tdup(mem_ctx, &info502_str->uni_netname); + if (s) + init_unistr2(&info502_str->uni_netname, + s, UNI_STR_TERMINATE); + + s = unistr2_tdup(mem_ctx, &info502_str->uni_remark); + if (s) + init_unistr2(&info502_str->uni_remark, + s, UNI_STR_TERMINATE); + + s = unistr2_tdup(mem_ctx, &info502_str->uni_path); + if (s) + init_unistr2(&info502_str->uni_path, + s, UNI_STR_TERMINATE); + + s = unistr2_tdup(mem_ctx, &info502_str->uni_passwd); + if (s) + init_unistr2(&info502_str->uni_passwd, + s, UNI_STR_TERMINATE); + + info502_str->sd = dup_sec_desc(mem_ctx, info502_str->sd); + break; + } + } + + done: + prs_mem_free(&qbuf); + prs_mem_free(&rbuf); + + return result; +} + WERROR cli_srvsvc_net_share_del(struct cli_state *cli, TALLOC_CTX *mem_ctx, const char *sharename) { diff --git a/source/rpc_server/srv_netlog_nt.c b/source/rpc_server/srv_netlog_nt.c index 3e0762fa43b..a3157435f37 100644 --- a/source/rpc_server/srv_netlog_nt.c +++ b/source/rpc_server/srv_netlog_nt.c @@ -486,8 +486,8 @@ NTSTATUS _net_srv_pwset(pipes_struct *p, NET_Q_SRV_PWSET *q_u, NET_R_SRV_PWSET * cred_hash3( pwd, q_u->pwd, p->dc.sess_key, 0); DEBUG(100,("Server password set : new given value was :\n")); - for(i = 0; i < 16; i++) - DEBUG(100,("%02X ", q_u->pwd[i])); + for(i = 0; i < sizeof(pwd); i++) + DEBUG(100,("%02X ", pwd[i])); DEBUG(100,("\n")); old_pw = pdb_get_nt_passwd(sampass); diff --git a/source/rpc_server/srv_spoolss_nt.c b/source/rpc_server/srv_spoolss_nt.c index e7b1fdb1d09..fad5555cea1 100644 --- a/source/rpc_server/srv_spoolss_nt.c +++ b/source/rpc_server/srv_spoolss_nt.c @@ -201,7 +201,7 @@ static void free_printer_entry(void *ptr) snum = -1; srv_spoolss_replycloseprinter(snum, &Printer->notify.client_hnd); } else if (Printer->printer_type == PRINTER_HANDLE_IS_PRINTER) { - snum = print_queue_snum(Printer->dev.handlename); + snum = print_queue_snum(Printer->sharename); if (snum != -1) srv_spoolss_replycloseprinter(snum, &Printer->notify.client_hnd); @@ -277,17 +277,19 @@ static Printer_entry *find_printer_index_by_hnd(pipes_struct *p, POLICY_HND *hnd ****************************************************************************/ WERROR find_printer_in_print_hnd_cache( TALLOC_CTX *ctx, NT_PRINTER_INFO_LEVEL_2 **info2, - const char *printername ) + const char *servername, const char *printername ) { Printer_entry *p; - DEBUG(10,("find_printer_in_print_hnd_cache: printer [%s]\n", printername)); + DEBUG(10,("find_printer_in_print_hnd_cache: printer [\\\\%s\\%s]\n", + servername, printername)); for ( p=printers_list; p; p=p->next ) { if ( p->printer_type==PRINTER_HANDLE_IS_PRINTER && p->printer_info - && StrCaseCmp(p->dev.handlename, printername) == 0 ) + && strequal( p->sharename, printername ) + && strequal( p->servername, servername ) ) { DEBUG(10,("Found printer\n")); *info2 = dup_printer_2( ctx, p->printer_info->info_2 ); @@ -313,7 +315,7 @@ void invalidate_printer_hnd_cache( char *printername ) { if ( p->printer_type==PRINTER_HANDLE_IS_PRINTER && p->printer_info - && StrCaseCmp(p->dev.handlename, printername)==0) + && StrCaseCmp(p->sharename, printername)==0) { DEBUG(10,("invalidating printer_info cache for handl:\n")); free_a_printer( &p->printer_info, 2 ); @@ -378,8 +380,8 @@ static WERROR delete_printer_handle(pipes_struct *p, POLICY_HND *hnd) } #endif - if (del_a_printer(Printer->dev.handlename) != 0) { - DEBUG(3,("Error deleting printer %s\n", Printer->dev.handlename)); + if (del_a_printer( Printer->sharename ) != 0) { + DEBUG(3,("Error deleting printer %s\n", Printer->sharename)); return WERR_BADFID; } @@ -389,9 +391,7 @@ static WERROR delete_printer_handle(pipes_struct *p, POLICY_HND *hnd) pstring command; int ret; - /* Printer->dev.handlename equals portname equals sharename */ - slprintf(command, sizeof(command)-1, "%s \"%s\"", cmd, - Printer->dev.handlename); + pstr_sprintf(command, "%s \"%s\"", cmd, Printer->sharename); DEBUG(10,("Running [%s]\n", command)); ret = smbrun(command, NULL); @@ -406,7 +406,7 @@ static WERROR delete_printer_handle(pipes_struct *p, POLICY_HND *hnd) /* go ahead and re-read the services immediately */ reload_services( False ); - if ( lp_servicenumber( Printer->dev.handlename ) < 0 ) + if ( lp_servicenumber( Printer->sharename ) < 0 ) return WERR_ACCESS_DENIED; } @@ -427,14 +427,14 @@ static BOOL get_printer_snum(pipes_struct *p, POLICY_HND *hnd, int *number) } switch (Printer->printer_type) { - case PRINTER_HANDLE_IS_PRINTER: - DEBUG(4,("short name:%s\n", Printer->dev.handlename)); - *number = print_queue_snum(Printer->dev.handlename); - return (*number != -1); - case PRINTER_HANDLE_IS_PRINTSERVER: - return False; - default: - return False; + case PRINTER_HANDLE_IS_PRINTER: + DEBUG(4,("short name:%s\n", Printer->sharename)); + *number = print_queue_snum(Printer->sharename); + return (*number != -1); + case PRINTER_HANDLE_IS_PRINTSERVER: + return False; + default: + return False; } } @@ -475,6 +475,7 @@ static BOOL set_printer_hnd_name(Printer_entry *Printer, char *handlename) int snum; int n_services=lp_numservices(); char *aprinter, *printername; + const char *servername; fstring sname; BOOL found=False; NT_PRINTER_INFO_LEVEL *printer; @@ -482,28 +483,37 @@ static BOOL set_printer_hnd_name(Printer_entry *Printer, char *handlename) DEBUG(4,("Setting printer name=%s (len=%lu)\n", handlename, (unsigned long)strlen(handlename))); - if (Printer->printer_type==PRINTER_HANDLE_IS_PRINTSERVER) { - ZERO_STRUCT(Printer->dev.printerservername); - strncpy(Printer->dev.printerservername, handlename, strlen(handlename)); - return True; - } - - if (Printer->printer_type!=PRINTER_HANDLE_IS_PRINTER) - return False; - - if (*handlename=='\\') { - aprinter=strchr_m(handlename+2, '\\'); - aprinter++; + aprinter = handlename; + if ( *handlename == '\\' ) { + servername = handlename + 2; + if ( (aprinter = strchr_m( handlename+2, '\\' )) != NULL ) { + *aprinter = '\0'; + aprinter++; + } } else { - aprinter=handlename; + servername = ""; } + + /* save the servername to fill in replies on this handle */ + + if ( !is_myname_or_ipaddr( servername ) ) + return False; - DEBUGADD(5, ("searching for [%s] (len=%lu)\n", aprinter, (unsigned long)strlen(aprinter))); + fstrcpy( Printer->servername, servername ); + + if ( Printer->printer_type == PRINTER_HANDLE_IS_PRINTSERVER ) + return True; - /* have to search on sharename and PRINTER_INFO2->printername */ + if ( Printer->printer_type != PRINTER_HANDLE_IS_PRINTER ) + return False; - for (snum=0; snum<n_services; snum++) { + DEBUGADD(5, ("searching for [%s]\n", aprinter )); + + /* Search all sharenames first as this is easier than pulling + the printer_info_2 off of disk */ + + for (snum=0; !found && snum<n_services; snum++) { if ( !(lp_snum_ok(snum) && lp_print_ok(snum) ) ) continue; @@ -516,10 +526,25 @@ static BOOL set_printer_hnd_name(Printer_entry *Printer, char *handlename) if ( strequal(sname, aprinter) ) { found = True; - break; + } + } + + + /* do another loop to look for printernames */ + + for (snum=0; !found && snum<n_services; snum++) { + + /* no point in checking if this is not a printer or + we aren't allowing printername != sharename */ + + if ( !(lp_snum_ok(snum) + && lp_print_ok(snum) + && !lp_force_printername(snum)) ) + { + continue; } - /* ------ printername ------ */ + fstrcpy(sname, lp_servicename(snum)); printer = NULL; result = get_a_printer( NULL, &printer, 2, sname ); @@ -538,29 +563,24 @@ static BOOL set_printer_hnd_name(Printer_entry *Printer, char *handlename) } printername++; - + if ( strequal(printername, aprinter) ) { found = True; } DEBUGADD(10, ("printername: %s\n", printername)); - free_a_printer( &printer, 2); - - if ( found ) - break; + free_a_printer( &printer, 2); } - - if (!found) { + if ( !found ) { DEBUGADD(4,("Printer not found\n")); return False; } DEBUGADD(4,("set_printer_hnd_name: Printer found: %s -> %s\n", aprinter, sname)); - ZERO_STRUCT(Printer->dev.handlename); - fstrcpy(Printer->dev.handlename, sname); + fstrcpy(Printer->sharename, sname); return True; } @@ -696,10 +716,8 @@ static BOOL is_monitoring_event(Printer_entry *p, uint16 notify_type, } } - DEBUG(10, ("%s is not monitoring 0x%02x/0x%02x\n", - (p->printer_type == PRINTER_HANDLE_IS_PRINTER) ? - p->dev.handlename : p->dev.printerservername, - notify_type, notify_field)); + DEBUG(10, ("Open handle for \\\\%s\\%s is not monitoring 0x%02x/0x%02x\n", + p->servername, p->sharename, notify_type, notify_field)); return False; } @@ -995,13 +1013,13 @@ static void send_notify2_changes( SPOOLSS_NOTIFY_MSG_CTR *ctr, uint32 idx ) if ( !p->notify.client_connected ) continue; - DEBUG(10,("Client connected! [%s]\n", p->dev.handlename)); + DEBUG(10,("Client connected! [\\\\%s\\%s]\n", p->servername, p->sharename)); /* For this printer? Print servers always receive notifications. */ if ( ( p->printer_type == PRINTER_HANDLE_IS_PRINTER ) && - ( !strequal(msg_group->printername, p->dev.handlename) ) ) + ( !strequal(msg_group->printername, p->sharename) ) ) continue; DEBUG(10,("Our printer\n")); @@ -1027,7 +1045,7 @@ static void send_notify2_changes( SPOOLSS_NOTIFY_MSG_CTR *ctr, uint32 idx ) DEBUG(10,("process_notify2_message: Sending message type [0x%x] field [0x%2x] for printer [%s]\n", - msg->type, msg->field, p->dev.handlename)); + msg->type, msg->field, p->sharename)); /* * if the is a printer notification handle and not a job notification @@ -1323,7 +1341,7 @@ void update_monitored_printq_cache( void ) if ( (printer->printer_type == PRINTER_HANDLE_IS_PRINTER) && printer->notify.client_connected ) { - snum = print_queue_snum(printer->dev.handlename); + snum = print_queue_snum(printer->sharename); print_queue_status( snum, NULL, NULL ); } @@ -1619,9 +1637,9 @@ WERROR _spoolss_open_printer_ex( pipes_struct *p, SPOOL_Q_OPEN_PRINTER_EX *q_u, return WERR_INVALID_PRINTER_NAME; Printer=find_printer_index_by_hnd(p, handle); - if (!Printer) { - DEBUG(0,(" _spoolss_open_printer_ex: logic error. \ -Can't find printer handle we created for printer %s\n", name )); + if ( !Printer ) { + DEBUG(0,(" _spoolss_open_printer_ex: logic error. Can't find printer " + "handle we created for printer %s\n", name )); close_printer_handle(p,handle); return WERR_INVALID_PRINTER_NAME; } @@ -1765,10 +1783,11 @@ Can't find printer handle we created for printer %s\n", name )); if ( (Printer->printer_type != PRINTER_HANDLE_IS_PRINTSERVER) && q_u->printer_default.devmode_cont.devmode_ptr ) { - convert_devicemode( Printer->dev.handlename, q_u->printer_default.devmode_cont.devmode, + convert_devicemode( Printer->sharename, q_u->printer_default.devmode_cont.devmode, &Printer->nt_devmode ); } +#if 0 /* JERRY -- I'm doubtful this is really effective */ /* HACK ALERT!!! Sleep for 1/3 of a second to try trigger a LAN/WAN optimization in Windows 2000 clients --jerry */ @@ -1778,6 +1797,7 @@ Can't find printer handle we created for printer %s\n", name )); DEBUG(10,("_spoolss_open_printer_ex: Enabling LAN/WAN hack for Win2k clients.\n")); sys_usleep( 500000 ); } +#endif return WERR_OK; } @@ -1983,6 +2003,7 @@ static int get_version_id (char * arch) {"Windows NT Alpha_AXP", "W32ALPHA", 2 }, {"Windows NT PowerPC", "W32PPC", 2 }, {"Windows IA64", "IA64", 3 }, + {"Windows x64", "x64", 3 }, {NULL, "", -1 } }; @@ -2747,12 +2768,10 @@ void spoolss_notify_server_name(int snum, NT_PRINTER_INFO_LEVEL *printer, TALLOC_CTX *mem_ctx) { - pstring temp_name, temp; + pstring temp; uint32 len; - slprintf(temp_name, sizeof(temp_name)-1, "\\\\%s", get_called_name()); - - len = rpcstr_push(temp, temp_name, sizeof(temp)-2, STR_TERMINATE); + len = rpcstr_push(temp, printer->info_2->servername, sizeof(temp)-2, STR_TERMINATE); data->notify_data.data.length = len; data->notify_data.data.string = (uint16 *)talloc(mem_ctx, len); @@ -3486,6 +3505,7 @@ static const struct s_notify_info_data_table notify_info_data_table[] = { JOB_NOTIFY_TYPE, JOB_NOTIFY_TOTAL_PAGES, "JOB_NOTIFY_TOTAL_PAGES", NOTIFY_ONE_VALUE, spoolss_notify_total_pages }, { JOB_NOTIFY_TYPE, JOB_NOTIFY_PAGES_PRINTED, "JOB_NOTIFY_PAGES_PRINTED", NOTIFY_ONE_VALUE, spoolss_notify_pages_printed }, { JOB_NOTIFY_TYPE, JOB_NOTIFY_TOTAL_BYTES, "JOB_NOTIFY_TOTAL_BYTES", NOTIFY_ONE_VALUE, spoolss_notify_job_size }, +{ PRINT_TABLE_END, 0x0, NULL, 0x0, NULL }, }; /******************************************************************* @@ -3551,7 +3571,7 @@ static int search_notify(uint16 type, uint16 field, int *value) { int i; - for (i = 0; i < sizeof(notify_info_data_table); i++) { + for (i = 0; notify_info_data_table[i].type != PRINT_TABLE_END; i++) { if (notify_info_data_table[i].type == type && notify_info_data_table[i].field == field && notify_info_data_table[i].fn != NULL) { @@ -3979,7 +3999,7 @@ static BOOL construct_printer_info_0(Printer_entry *print_hnd, PRINTER_INFO_0 *p init_unistr(&printer->printername, chaine); - slprintf(chaine,sizeof(chaine)-1,"\\\\%s", get_called_name()); + slprintf(chaine,sizeof(chaine)-1,"\\\\%s", get_server_name(print_hnd)); init_unistr(&printer->servername, chaine); printer->cjobs = count; @@ -4444,6 +4464,7 @@ static WERROR enum_all_printers_info_1_name(fstring name, NEW_BUFFER *buffer, ui return WERR_INVALID_NAME; } +#if 0 /* JERRY -- disabled for now. Don't think this is used, tested, or correct */ /******************************************************************** enum_all_printers_info_1_remote. *********************************************************************/ @@ -4458,9 +4479,10 @@ static WERROR enum_all_printers_info_1_remote(fstring name, NEW_BUFFER *buffer, /* JFM: currently it's more a place holder than anything else. * In the spooler world there is a notion of server registration. - * the print servers are registring (sp ?) on the PDC (in the same domain) + * the print servers are registered on the PDC (in the same domain) * - * We should have a TDB here. The registration is done thru an undocumented RPC call. + * We should have a TDB here. The registration is done thru an + * undocumented RPC call. */ if((printer=(PRINTER_INFO_1 *)malloc(sizeof(PRINTER_INFO_1))) == NULL) @@ -4468,8 +4490,8 @@ static WERROR enum_all_printers_info_1_remote(fstring name, NEW_BUFFER *buffer, *returned=1; - slprintf(printername, sizeof(printername)-1,"Windows NT Remote Printers!!\\\\%s", get_called_name()); - slprintf(desc, sizeof(desc)-1,"%s", get_called_name()); + slprintf(printername, sizeof(printername)-1,"Windows NT Remote Printers!!\\\\%s", name); + slprintf(desc, sizeof(desc)-1,"%s", name); slprintf(comment, sizeof(comment)-1, "Logged on Domain"); init_unistr(&printer->description, desc); @@ -4499,6 +4521,8 @@ static WERROR enum_all_printers_info_1_remote(fstring name, NEW_BUFFER *buffer, return WERR_OK; } +#endif + /******************************************************************** enum_all_printers_info_1_network. *********************************************************************/ @@ -4605,8 +4629,10 @@ static WERROR enumprinters_level1( uint32 flags, fstring name, if (flags & PRINTER_ENUM_NAME) return enum_all_printers_info_1_name(name, buffer, offered, needed, returned); +#if 0 /* JERRY - disabled for now */ if (flags & PRINTER_ENUM_REMOTE) return enum_all_printers_info_1_remote(name, buffer, offered, needed, returned); +#endif if (flags & PRINTER_ENUM_NETWORK) return enum_all_printers_info_1_network(name, buffer, offered, needed, returned); @@ -5543,6 +5569,7 @@ WERROR _spoolss_getprinterdriver2(pipes_struct *p, SPOOL_Q_GETPRINTERDRIVER2 *q_ uint32 *needed = &r_u->needed; uint32 *servermajorversion = &r_u->servermajorversion; uint32 *serverminorversion = &r_u->serverminorversion; + Printer_entry *printer; fstring servername; fstring architecture; @@ -5554,11 +5581,16 @@ WERROR _spoolss_getprinterdriver2(pipes_struct *p, SPOOL_Q_GETPRINTERDRIVER2 *q_ DEBUG(4,("_spoolss_getprinterdriver2\n")); + if ( !(printer = find_printer_index_by_hnd( p, handle )) ) { + DEBUG(0,("_spoolss_getprinterdriver2: invalid printer handle!\n")); + return WERR_INVALID_PRINTER_NAME; + } + *needed = 0; *servermajorversion = 0; *serverminorversion = 0; - fstrcpy(servername, get_called_name()); + fstrcpy(servername, get_server_name( printer )); unistr2_to_ascii(architecture, uni_arch, sizeof(architecture)-1); if (!get_printer_snum(p, handle, &snum)) @@ -5840,11 +5872,9 @@ static WERROR update_printer_sec(POLICY_HND *handle, uint32 level, } /* NT seems to like setting the security descriptor even though - nothing may have actually changed. This causes annoying - dialog boxes when the user doesn't have permission to change - the security descriptor. */ + nothing may have actually changed. */ - nt_printing_getsec(p->mem_ctx, Printer->dev.handlename, &old_secdesc_ctr); + nt_printing_getsec(p->mem_ctx, Printer->sharename, &old_secdesc_ctr); if (DEBUGLEVEL >= 10) { SEC_ACL *the_acl; @@ -5903,7 +5933,7 @@ static WERROR update_printer_sec(POLICY_HND *handle, uint32 level, goto done; } - result = nt_printing_setsec(Printer->dev.handlename, new_secdesc_ctr); + result = nt_printing_setsec(Printer->sharename, new_secdesc_ctr); done: @@ -5911,9 +5941,12 @@ static WERROR update_printer_sec(POLICY_HND *handle, uint32 level, } /******************************************************************** - Do Samba sanity checks on a printer info struct. - this has changed purpose: it now "canonicalises" printer - info from a client rather than just checking it is correct + Canonicalize printer info from a client + + ATTN: It does not matter what we set the servername to hear + since we do the necessary work in get_a_printer() to set it to + the correct value based on what the client sent in the + _spoolss_open_printer_ex(). ********************************************************************/ static BOOL check_printer_ok(NT_PRINTER_INFO_LEVEL_2 *info, int snum) @@ -5921,25 +5954,35 @@ static BOOL check_printer_ok(NT_PRINTER_INFO_LEVEL_2 *info, int snum) fstring printername; const char *p; - DEBUG(5,("check_printer_ok: servername=%s printername=%s sharename=%s portname=%s drivername=%s comment=%s location=%s\n", - info->servername, info->printername, info->sharename, info->portname, info->drivername, info->comment, info->location)); + DEBUG(5,("check_printer_ok: servername=%s printername=%s sharename=%s " + "portname=%s drivername=%s comment=%s location=%s\n", + info->servername, info->printername, info->sharename, + info->portname, info->drivername, info->comment, info->location)); /* we force some elements to "correct" values */ - slprintf(info->servername, sizeof(info->servername)-1, "\\\\%s", get_called_name()); + slprintf(info->servername, sizeof(info->servername)-1, "\\\\%s", global_myname()); fstrcpy(info->sharename, lp_servicename(snum)); - /* make sure printername is in \\server\printername format */ + /* check to see if we allow printername != sharename */ + + if ( lp_force_printername(snum) ) { + slprintf(info->printername, sizeof(info->printername)-1, "\\\\%s\\%s", + global_myname(), info->sharename ); + } else { + + /* make sure printername is in \\server\printername format */ - fstrcpy( printername, info->printername ); - p = printername; - if ( printername[0] == '\\' && printername[1] == '\\' ) { - if ( (p = strchr_m( &printername[2], '\\' )) != NULL ) - p++; + fstrcpy( printername, info->printername ); + p = printername; + if ( printername[0] == '\\' && printername[1] == '\\' ) { + if ( (p = strchr_m( &printername[2], '\\' )) != NULL ) + p++; + } + + slprintf(info->printername, sizeof(info->printername)-1, "\\\\%s\\%s", + global_myname(), p ); } - - slprintf(info->printername, sizeof(info->printername)-1, "\\\\%s\\%s", - get_called_name(), p ); - + info->attributes |= PRINTER_ATTRIBUTE_SAMBA; info->attributes &= ~PRINTER_ATTRIBUTE_NOT_SAMBA; @@ -6322,18 +6365,16 @@ WERROR _spoolss_addjob(pipes_struct *p, SPOOL_Q_ADDJOB *q_u, SPOOL_R_ADDJOB *r_u ****************************************************************************/ static void fill_job_info_1(JOB_INFO_1 *job_info, print_queue_struct *queue, - int position, int snum) + int position, int snum, + NT_PRINTER_INFO_LEVEL *ntprinter) { - pstring temp_name; - struct tm *t; t=gmtime(&queue->time); - slprintf(temp_name, sizeof(temp_name)-1, "\\\\%s", get_called_name()); job_info->jobid=queue->job; init_unistr(&job_info->printername, lp_servicename(snum)); - init_unistr(&job_info->machinename, temp_name); + init_unistr(&job_info->machinename, ntprinter->info_2->servername); init_unistr(&job_info->username, queue->fs_user); init_unistr(&job_info->document, queue->fs_file); init_unistr(&job_info->datatype, "RAW"); @@ -6355,17 +6396,15 @@ static BOOL fill_job_info_2(JOB_INFO_2 *job_info, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *ntprinter, DEVICEMODE *devmode) { - pstring temp_name; struct tm *t; t=gmtime(&queue->time); - slprintf(temp_name, sizeof(temp_name)-1, "\\\\%s", get_called_name()); job_info->jobid=queue->job; init_unistr(&job_info->printername, ntprinter->info_2->printername); - init_unistr(&job_info->machinename, temp_name); + init_unistr(&job_info->machinename, ntprinter->info_2->servername); init_unistr(&job_info->username, queue->fs_user); init_unistr(&job_info->document, queue->fs_file); init_unistr(&job_info->notifyname, queue->fs_user); @@ -6398,6 +6437,7 @@ static BOOL fill_job_info_2(JOB_INFO_2 *job_info, print_queue_struct *queue, ****************************************************************************/ static WERROR enumjobs_level1(print_queue_struct *queue, int snum, + NT_PRINTER_INFO_LEVEL *ntprinter, NEW_BUFFER *buffer, uint32 offered, uint32 *needed, uint32 *returned) { @@ -6412,7 +6452,7 @@ static WERROR enumjobs_level1(print_queue_struct *queue, int snum, } for (i=0; i<*returned; i++) - fill_job_info_1(&info[i], &queue[i], i, snum); + fill_job_info_1( &info[i], &queue[i], i, snum, ntprinter ); SAFE_FREE(queue); @@ -6445,10 +6485,10 @@ static WERROR enumjobs_level1(print_queue_struct *queue, int snum, ****************************************************************************/ static WERROR enumjobs_level2(print_queue_struct *queue, int snum, + NT_PRINTER_INFO_LEVEL *ntprinter, NEW_BUFFER *buffer, uint32 offered, uint32 *needed, uint32 *returned) { - NT_PRINTER_INFO_LEVEL *ntprinter = NULL; JOB_INFO_2 *info = NULL; int i; WERROR result; @@ -6460,12 +6500,6 @@ static WERROR enumjobs_level2(print_queue_struct *queue, int snum, result = WERR_NOMEM; goto done; } - - result = get_a_printer(NULL, &ntprinter, 2, lp_servicename(snum)); - if (!W_ERROR_IS_OK(result)) { - *returned = 0; - goto done; - } /* this should not be a failure condition if the devmode is NULL */ @@ -6523,7 +6557,7 @@ WERROR _spoolss_enumjobs( pipes_struct *p, SPOOL_Q_ENUMJOBS *q_u, SPOOL_R_ENUMJO uint32 *needed = &r_u->needed; uint32 *returned = &r_u->returned; WERROR wret; - + NT_PRINTER_INFO_LEVEL *ntprinter = NULL; int snum; print_status_struct prt_status; print_queue_struct *queue=NULL; @@ -6537,9 +6571,15 @@ WERROR _spoolss_enumjobs( pipes_struct *p, SPOOL_Q_ENUMJOBS *q_u, SPOOL_R_ENUMJO *needed=0; *returned=0; + /* lookup the printer snum and tdb entry */ + if (!get_printer_snum(p, handle, &snum)) return WERR_BADFID; + wret = get_a_printer(NULL, &ntprinter, 2, lp_servicename(snum)); + if ( !W_ERROR_IS_OK(wret) ) + return wret; + *returned = print_queue_status(snum, &queue, &prt_status); DEBUGADD(4,("count:[%d], status:[%d], [%s]\n", *returned, prt_status.status, prt_status.message)); @@ -6550,16 +6590,19 @@ WERROR _spoolss_enumjobs( pipes_struct *p, SPOOL_Q_ENUMJOBS *q_u, SPOOL_R_ENUMJO switch (level) { case 1: - wret = enumjobs_level1(queue, snum, buffer, offered, needed, returned); + wret = enumjobs_level1(queue, snum, ntprinter, buffer, offered, needed, returned); return wret; case 2: - wret = enumjobs_level2(queue, snum, buffer, offered, needed, returned); + wret = enumjobs_level2(queue, snum, ntprinter, buffer, offered, needed, returned); return wret; default: SAFE_FREE(queue); *returned=0; - return WERR_UNKNOWN_LEVEL; + wret = WERR_UNKNOWN_LEVEL; } + + free_a_printer( &ntprinter, 2 ); + return wret; } /**************************************************************************** @@ -6587,7 +6630,7 @@ WERROR _spoolss_setjob(pipes_struct *p, SPOOL_Q_SETJOB *q_u, SPOOL_R_SETJOB *r_u return WERR_BADFID; } - if (!print_job_exists(snum, jobid)) { + if (!print_job_exists(lp_const_servicename(snum), jobid)) { return WERR_INVALID_PRINTER_NAME; } @@ -6866,7 +6909,6 @@ static WERROR enumprinterdrivers_level3(fstring servername, fstring architecture WERROR _spoolss_enumprinterdrivers( pipes_struct *p, SPOOL_Q_ENUMPRINTERDRIVERS *q_u, SPOOL_R_ENUMPRINTERDRIVERS *r_u) { - UNISTR2 *environment = &q_u->environment; uint32 level = q_u->level; NEW_BUFFER *buffer = NULL; uint32 offered = q_u->offered; @@ -6882,11 +6924,14 @@ WERROR _spoolss_enumprinterdrivers( pipes_struct *p, SPOOL_Q_ENUMPRINTERDRIVERS buffer = r_u->buffer; DEBUG(4,("_spoolss_enumprinterdrivers\n")); - fstrcpy(servername, get_called_name()); *needed=0; *returned=0; - unistr2_to_ascii(architecture, environment, sizeof(architecture)-1); + unistr2_to_ascii(architecture, &q_u->environment, sizeof(architecture)-1); + unistr2_to_ascii(servername, &q_u->name, sizeof(servername)-1); + + if ( !is_myname_or_ipaddr( servername ) ) + return WERR_UNKNOWN_PRINTER_DRIVER; switch (level) { case 1: @@ -7387,7 +7432,10 @@ static WERROR spoolss_addprinterex_level_2( pipes_struct *p, const UNISTR2 *uni_ } } - slprintf(name, sizeof(name)-1, "\\\\%s\\%s", get_called_name(), + /* use our primary netbios name since get_a_printer() will convert + it to what the client expects on a case by case basis */ + + slprintf(name, sizeof(name)-1, "\\\\%s\\%s", global_myname(), printer->info_2->sharename); @@ -7659,18 +7707,32 @@ static WERROR getprinterdriverdir_level_1(UNISTR2 *name, UNISTR2 *uni_environmen { pstring path; pstring long_archi; + fstring servername; + char *pservername; const char *short_archi; DRIVER_DIRECTORY_1 *info=NULL; + unistr2_to_ascii(servername, name, sizeof(servername)-1); unistr2_to_ascii(long_archi, uni_environment, sizeof(long_archi)-1); + /* check for beginning double '\'s and that the server + long enough */ + + pservername = servername; + if ( *pservername == '\\' && strlen(servername)>2 ) { + pservername += 2; + } + + if ( !is_myname_or_ipaddr( pservername ) ) + return WERR_INVALID_PARAM; + if (!(short_archi = get_short_archi(long_archi))) return WERR_INVALID_ENVIRONMENT; if((info=(DRIVER_DIRECTORY_1 *)malloc(sizeof(DRIVER_DIRECTORY_1))) == NULL) return WERR_NOMEM; - slprintf(path, sizeof(path)-1, "\\\\%s\\print$\\%s", get_called_name(), short_archi); + slprintf(path, sizeof(path)-1, "\\\\%s\\print$\\%s", pservername, short_archi); DEBUG(4,("printer driver directory: [%s]\n", path)); @@ -8496,7 +8558,10 @@ WERROR _spoolss_enumprintmonitors(pipes_struct *p, SPOOL_Q_ENUMPRINTMONITORS *q_ /**************************************************************************** ****************************************************************************/ -static WERROR getjob_level_1(print_queue_struct **queue, int count, int snum, uint32 jobid, NEW_BUFFER *buffer, uint32 offered, uint32 *needed) +static WERROR getjob_level_1(print_queue_struct **queue, int count, int snum, + NT_PRINTER_INFO_LEVEL *ntprinter, + uint32 jobid, NEW_BUFFER *buffer, uint32 offered, + uint32 *needed) { int i=0; BOOL found=False; @@ -8519,7 +8584,7 @@ static WERROR getjob_level_1(print_queue_struct **queue, int count, int snum, ui return WERR_INVALID_PARAM; } - fill_job_info_1(info_1, &((*queue)[i-1]), i, snum); + fill_job_info_1( info_1, &((*queue)[i-1]), i, snum, ntprinter ); *needed += spoolss_size_job_info_1(info_1); @@ -8541,12 +8606,14 @@ static WERROR getjob_level_1(print_queue_struct **queue, int count, int snum, ui /**************************************************************************** ****************************************************************************/ -static WERROR getjob_level_2(print_queue_struct **queue, int count, int snum, uint32 jobid, NEW_BUFFER *buffer, uint32 offered, uint32 *needed) +static WERROR getjob_level_2(print_queue_struct **queue, int count, int snum, + NT_PRINTER_INFO_LEVEL *ntprinter, + uint32 jobid, NEW_BUFFER *buffer, uint32 offered, + uint32 *needed) { int i = 0; BOOL found = False; JOB_INFO_2 *info_2; - NT_PRINTER_INFO_LEVEL *ntprinter = NULL; WERROR ret; DEVICEMODE *devmode = NULL; NT_DEVICEMODE *nt_devmode = NULL; @@ -8574,17 +8641,13 @@ static WERROR getjob_level_2(print_queue_struct **queue, int count, int snum, ui goto done; } - ret = get_a_printer(NULL, &ntprinter, 2, lp_const_servicename(snum)); - if (!W_ERROR_IS_OK(ret)) - goto done; - /* * if the print job does not have a DEVMODE associated with it, * just use the one for the printer. A NULL devicemode is not * a failure condition */ - if ( !(nt_devmode=print_job_devmode( snum, jobid )) ) + if ( !(nt_devmode=print_job_devmode( lp_const_servicename(snum), jobid )) ) devmode = construct_dev_mode(snum); else { if ((devmode = (DEVICEMODE *)malloc(sizeof(DEVICEMODE))) != NULL) { @@ -8616,7 +8679,6 @@ static WERROR getjob_level_2(print_queue_struct **queue, int count, int snum, ui free_job_info_2(info_2); /* Also frees devmode */ SAFE_FREE(info_2); - free_a_printer(&ntprinter, 2); return ret; } @@ -8633,7 +8695,7 @@ WERROR _spoolss_getjob( pipes_struct *p, SPOOL_Q_GETJOB *q_u, SPOOL_R_GETJOB *r_ uint32 offered = q_u->offered; uint32 *needed = &r_u->needed; WERROR wstatus = WERR_OK; - + NT_PRINTER_INFO_LEVEL *ntprinter = NULL; int snum; int count; print_queue_struct *queue = NULL; @@ -8650,6 +8712,10 @@ WERROR _spoolss_getjob( pipes_struct *p, SPOOL_Q_GETJOB *q_u, SPOOL_R_GETJOB *r_ if (!get_printer_snum(p, handle, &snum)) return WERR_BADFID; + wstatus = get_a_printer(NULL, &ntprinter, 2, lp_servicename(snum)); + if ( !W_ERROR_IS_OK(wstatus) ) + return wstatus; + count = print_queue_status(snum, &queue, &prt_status); DEBUGADD(4,("count:[%d], prt_status:[%d], [%s]\n", @@ -8657,11 +8723,11 @@ WERROR _spoolss_getjob( pipes_struct *p, SPOOL_Q_GETJOB *q_u, SPOOL_R_GETJOB *r_ switch ( level ) { case 1: - wstatus = getjob_level_1(&queue, count, snum, jobid, + wstatus = getjob_level_1(&queue, count, snum, ntprinter, jobid, buffer, offered, needed); break; case 2: - wstatus = getjob_level_2(&queue, count, snum, jobid, + wstatus = getjob_level_2(&queue, count, snum, ntprinter, jobid, buffer, offered, needed); break; default: @@ -8670,6 +8736,8 @@ WERROR _spoolss_getjob( pipes_struct *p, SPOOL_Q_GETJOB *q_u, SPOOL_R_GETJOB *r_ } SAFE_FREE(queue); + free_a_printer( &ntprinter, 2 ); + return wstatus; } diff --git a/source/rpc_server/srv_util.c b/source/rpc_server/srv_util.c index 5bb8db4e062..ce8e02fae79 100644 --- a/source/rpc_server/srv_util.c +++ b/source/rpc_server/srv_util.c @@ -3,7 +3,8 @@ * RPC Pipe client / server routines * Copyright (C) Andrew Tridgell 1992-1998 * Copyright (C) Luke Kenneth Casson Leighton 1996-1998, - * Copyright (C) Paul Ashton 1997-1998. + * Copyright (C) Paul Ashton 1997-1998, + * Copyright (C) Andrew Bartlett 2004. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -46,7 +47,7 @@ * and groups. */ -rid_name builtin_alias_rids[] = +static const rid_name builtin_alias_rids[] = { { BUILTIN_ALIAS_RID_ADMINS , "Administrators" }, { BUILTIN_ALIAS_RID_USERS , "Users" }, @@ -62,7 +63,7 @@ rid_name builtin_alias_rids[] = }; /* array lookup of well-known Domain RID users. */ -rid_name domain_user_rids[] = +static const rid_name domain_user_rids[] = { { DOMAIN_USER_RID_ADMIN , "Administrator" }, { DOMAIN_USER_RID_GUEST , "Guest" }, @@ -70,7 +71,7 @@ rid_name domain_user_rids[] = }; /* array lookup of well-known Domain RID groups. */ -rid_name domain_group_rids[] = +static const rid_name domain_group_rids[] = { { DOMAIN_GROUP_RID_ADMINS , "Domain Admins" }, { DOMAIN_GROUP_RID_USERS , "Domain Users" }, @@ -98,17 +99,6 @@ NTSTATUS get_alias_user_groups(TALLOC_CTX *ctx, DOM_SID *sid, int *numgroups, ui BOOL ret; BOOL winbind_groups_exist; - /* - * this code is far from perfect. - * first it enumerates the full /etc/group and that can be slow. - * second, it works only with users' SIDs - * whereas the day we support nested groups, it will have to - * support both users's SIDs and domain groups' SIDs - * - * having our own ldap backend would be so much faster ! - * we're far from that, but hope one day ;-) JFM. - */ - *prids=NULL; *numgroups=0; @@ -136,11 +126,8 @@ NTSTATUS get_alias_user_groups(TALLOC_CTX *ctx, DOM_SID *sid, int *numgroups, ui return NT_STATUS_UNSUCCESSFUL; } - become_root(); - /* on some systems this must run as root */ - num_groups = getgroups_user(user_name, &groups); - unbecome_root(); - if (num_groups == -1) { + ret = getgroups_user(user_name, &groups, &num_groups); + if (!ret) { /* this should never happen */ DEBUG(2,("get_alias_user_groups: getgroups_user failed\n")); pdb_free_sam(&sam_pass); @@ -272,115 +259,57 @@ done: ********************************************************************/ BOOL get_domain_user_groups(TALLOC_CTX *ctx, int *numgroups, DOM_GID **pgids, SAM_ACCOUNT *sam_pass) { - GROUP_MAP *map=NULL; - int i, num, num_entries, cur_gid=0; - struct group *grp; - DOM_GID *gids; - fstring user_name; - uint32 grid; - uint32 tmp_rid; - BOOL ret; - - *numgroups= 0; - - fstrcpy(user_name, pdb_get_username(sam_pass)); - grid=pdb_get_group_rid(sam_pass); - - DEBUG(10,("get_domain_user_groups: searching domain groups [%s] is a member of\n", user_name)); - - /* we must wrap this is become/unbecome root for ldap backends */ - - become_root(); - /* first get the list of the domain groups */ - ret = pdb_enum_group_mapping(SID_NAME_DOM_GRP, &map, &num_entries, ENUM_ONLY_MAPPED); - - unbecome_root(); - /* end wrapper for group enumeration */ + const char *username = pdb_get_username(sam_pass); + int n_unix_groups; + int i,j; + gid_t *unix_groups; + *numgroups = 0; + *pgids = NULL; - if ( !ret ) + if (!getgroups_user(username, &unix_groups, &n_unix_groups)) { return False; - - DEBUG(10,("get_domain_user_groups: there are %d mapped groups\n", num_entries)); - - - /* - * alloc memory. In the worse case, we alloc memory for nothing. - * but I prefer to alloc for nothing - * than reallocing everytime. - */ - gids = (DOM_GID *)talloc(ctx, sizeof(DOM_GID) * num_entries); + } - /* for each group, check if the user is a member of. Only include groups - from this domain */ + /* now setup the space for storing the SIDS */ - for(i=0; i<num_entries; i++) { + if (n_unix_groups > 0) { - if ( !sid_check_is_in_our_domain(&map[i].sid) ) { - DEBUG(10,("get_domain_user_groups: skipping check of %s since it is not in our domain\n", - map[i].nt_name)); - continue; - } - - if ((grp=getgrgid(map[i].gid)) == NULL) { - /* very weird !!! */ - DEBUG(5,("get_domain_user_groups: gid %d doesn't exist anymore !\n", (int)map[i].gid)); - continue; - } - - for(num=0; grp->gr_mem[num]!=NULL; num++) { - if(strcmp(grp->gr_mem[num], user_name)==0) { - /* we found the user, add the group to the list */ - sid_peek_rid(&map[i].sid, &(gids[cur_gid].g_rid)); - gids[cur_gid].attr=7; - DEBUG(10,("get_domain_user_groups: user found in group %s\n", map[i].nt_name)); - cur_gid++; - break; - } + *pgids = talloc(ctx, sizeof(DOM_GID) * n_unix_groups); + + if (!*pgids) { + DEBUG(0, ("get_user_group: malloc() failed for DOM_GID list!\n")); + SAFE_FREE(unix_groups); + return False; } } - /* we have checked the groups */ - /* we must now check the gid of the user or the primary group rid, that's the same */ - for (i=0; i<cur_gid && grid!=gids[i].g_rid; i++) - ; - - /* the user's gid is already there */ - if (i!=cur_gid) { - /* - * the primary group of the user but be the first one in the list - * don't ask ! JFM. - */ - gids[i].g_rid=gids[0].g_rid; - gids[0].g_rid=grid; - goto done; - } - - for(i=0; i<num_entries; i++) { - sid_peek_rid(&map[i].sid, &tmp_rid); - if (tmp_rid==grid) { - /* - * the primary group of the user but be the first one in the list - * don't ask ! JFM. - */ - gids[cur_gid].g_rid=gids[0].g_rid; - gids[0].g_rid=tmp_rid; - gids[cur_gid].attr=7; - DEBUG(10,("get_domain_user_groups: primary gid of user found in group %s\n", map[i].nt_name)); - cur_gid++; - goto done; /* leave the loop early */ + become_root(); + j = 0; + for (i = 0; i < n_unix_groups; i++) { + GROUP_MAP map; + uint32 rid; + + if (!pdb_getgrgid(&map, unix_groups[i])) { + DEBUG(3, ("get_user_groups: failed to convert gid %ld to a domain group!\n", + (long int)unix_groups[i+1])); + if (i == 0) { + DEBUG(1,("get_domain_user_groups: primary gid of user [%s] is not a Domain group !\n", username)); + DEBUGADD(1,("get_domain_user_groups: You should fix it, NT doesn't like that\n")); + } + } else if ((map.sid_name_use == SID_NAME_DOM_GRP) + && sid_peek_check_rid(get_global_sam_sid(), &map.sid, &rid)) { + (*pgids)[j].attr=7; + (*pgids)[j].g_rid=rid; + j++; } } + unbecome_root(); - DEBUG(0,("get_domain_user_groups: primary gid of user [%s] is not a Domain group !\n", user_name)); - DEBUGADD(0,("get_domain_user_groups: You should fix it, NT doesn't like that\n")); - + *numgroups = j; - done: - *pgids=gids; - *numgroups=cur_gid; - SAFE_FREE(map); + SAFE_FREE(unix_groups); return True; } @@ -414,167 +343,3 @@ NTSTATUS nt_token_to_group_list(TALLOC_CTX *mem_ctx, const DOM_SID *domain_sid, return NT_STATUS_OK; } -/******************************************************************* - Look up a local (domain) rid and return a name and type. - ********************************************************************/ -NTSTATUS local_lookup_group_name(uint32 rid, char *group_name, uint32 *type) -{ - int i = 0; - (*type) = SID_NAME_DOM_GRP; - - DEBUG(5,("lookup_group_name: rid: %d", rid)); - - while (domain_group_rids[i].rid != rid && domain_group_rids[i].rid != 0) - { - i++; - } - - if (domain_group_rids[i].rid != 0) - { - fstrcpy(group_name, domain_group_rids[i].name); - DEBUG(5,(" = %s\n", group_name)); - return NT_STATUS_OK; - } - - DEBUG(5,(" none mapped\n")); - return NT_STATUS_NONE_MAPPED; -} - -/******************************************************************* - Look up a local alias rid and return a name and type. - ********************************************************************/ -NTSTATUS local_lookup_alias_name(uint32 rid, char *alias_name, uint32 *type) -{ - int i = 0; - (*type) = SID_NAME_WKN_GRP; - - DEBUG(5,("lookup_alias_name: rid: %d", rid)); - - while (builtin_alias_rids[i].rid != rid && builtin_alias_rids[i].rid != 0) - { - i++; - } - - if (builtin_alias_rids[i].rid != 0) - { - fstrcpy(alias_name, builtin_alias_rids[i].name); - DEBUG(5,(" = %s\n", alias_name)); - return NT_STATUS_OK; - } - - DEBUG(5,(" none mapped\n")); - return NT_STATUS_NONE_MAPPED; -} - - -#if 0 /*Nobody uses this function just now*/ -/******************************************************************* - Look up a local user rid and return a name and type. - ********************************************************************/ -NTSTATUS local_lookup_user_name(uint32 rid, char *user_name, uint32 *type) -{ - SAM_ACCOUNT *sampwd=NULL; - int i = 0; - BOOL ret; - - (*type) = SID_NAME_USER; - - DEBUG(5,("lookup_user_name: rid: %d", rid)); - - /* look up the well-known domain user rids first */ - while (domain_user_rids[i].rid != rid && domain_user_rids[i].rid != 0) - { - i++; - } - - if (domain_user_rids[i].rid != 0) { - fstrcpy(user_name, domain_user_rids[i].name); - DEBUG(5,(" = %s\n", user_name)); - return NT_STATUS_OK; - } - - pdb_init_sam(&sampwd); - - /* ok, it's a user. find the user account */ - become_root(); - ret = pdb_getsampwrid(sampwd, rid); - unbecome_root(); - - if (ret == True) { - fstrcpy(user_name, pdb_get_username(sampwd) ); - DEBUG(5,(" = %s\n", user_name)); - pdb_free_sam(&sampwd); - return NT_STATUS_OK; - } - - DEBUG(5,(" none mapped\n")); - pdb_free_sam(&sampwd); - return NT_STATUS_NONE_MAPPED; -} - -#endif - -/******************************************************************* - Look up a local (domain) group name and return a rid - ********************************************************************/ -NTSTATUS local_lookup_group_rid(char *group_name, uint32 *rid) -{ - const char *grp_name; - int i = -1; /* start do loop at -1 */ - - do /* find, if it exists, a group rid for the group name*/ - { - i++; - (*rid) = domain_group_rids[i].rid; - grp_name = domain_group_rids[i].name; - - } while (grp_name != NULL && !strequal(grp_name, group_name)); - - return (grp_name != NULL) ? NT_STATUS_OK : NT_STATUS_NONE_MAPPED; -} - -/******************************************************************* - Look up a local (BUILTIN) alias name and return a rid - ********************************************************************/ -NTSTATUS local_lookup_alias_rid(const char *alias_name, uint32 *rid) -{ - const char *als_name; - int i = -1; /* start do loop at -1 */ - - do /* find, if it exists, a alias rid for the alias name*/ - { - i++; - (*rid) = builtin_alias_rids[i].rid; - als_name = builtin_alias_rids[i].name; - - } while (als_name != NULL && !strequal(als_name, alias_name)); - - return (als_name != NULL) ? NT_STATUS_OK : NT_STATUS_NONE_MAPPED; -} - -/******************************************************************* - Look up a local user name and return a rid - ********************************************************************/ -NTSTATUS local_lookup_user_rid(char *user_name, uint32 *rid) -{ - SAM_ACCOUNT *sampass=NULL; - BOOL ret; - - (*rid) = 0; - - pdb_init_sam(&sampass); - - /* find the user account */ - become_root(); - ret = pdb_getsampwnam(sampass, user_name); - unbecome_root(); - - if (ret == True) { - (*rid) = pdb_get_user_rid(sampass); - pdb_free_sam(&sampass); - return NT_STATUS_OK; - } - - pdb_free_sam(&sampass); - return NT_STATUS_NONE_MAPPED; -} diff --git a/source/rpcclient/cmd_spoolss.c b/source/rpcclient/cmd_spoolss.c index e99cd9f9056..a9882d799f8 100644 --- a/source/rpcclient/cmd_spoolss.c +++ b/source/rpcclient/cmd_spoolss.c @@ -40,6 +40,7 @@ static const struct table_node archi_table[]= { {"Windows NT Alpha_AXP", "W32ALPHA", 2 }, {"Windows NT PowerPC", "W32PPC", 2 }, {"Windows IA64", "IA64", 3 }, + {"Windows x64", "x64", 3 }, {NULL, "", -1 } }; diff --git a/source/sam/idmap.c b/source/sam/idmap.c index d541776f391..3abfb0ae9f1 100644 --- a/source/sam/idmap.c +++ b/source/sam/idmap.c @@ -134,7 +134,10 @@ BOOL idmap_init(const char **remote_backend) if((remote_map = get_methods(rem_backend, False)) || (NT_STATUS_IS_OK(smb_probe_module("idmap", rem_backend)) && (remote_map = get_methods(rem_backend, False)))) { - remote_map->init(params); + if (!NT_STATUS_IS_OK(remote_map->init(params))) { + DEBUG(0, ("idmap_init: failed to initialize remote backend!\n")); + return False; + } } else { DEBUG(0, ("idmap_init: could not load remote backend '%s'\n", rem_backend)); SAFE_FREE(rem_backend); @@ -200,6 +203,7 @@ NTSTATUS idmap_get_id_from_sid(unid_t *id, int *id_type, const DOM_SID *sid) { NTSTATUS ret; int loc_type; + unid_t loc_id; if (proxyonly) return NT_STATUS_UNSUCCESSFUL; @@ -223,6 +227,32 @@ NTSTATUS idmap_get_id_from_sid(unid_t *id, int *id_type, const DOM_SID *sid) return ret; } + /* Before forking out to the possibly slow remote map, lets see if we + * already have the sid as uid when asking for a gid or vice versa. */ + + loc_type = *id_type & ID_TYPEMASK; + + switch (loc_type) { + case ID_USERID: + loc_type = ID_GROUPID; + break; + case ID_GROUPID: + loc_type = ID_USERID; + break; + default: + loc_type = ID_EMPTY; + } + + loc_type |= ID_QUERY_ONLY; + + ret = cache_map->get_id_from_sid(&loc_id, &loc_type, sid); + + if (NT_STATUS_IS_OK(ret)) { + /* Ok, we have the uid as gid or vice versa. The remote map + * would not know anything different, so return here. */ + return NT_STATUS_UNSUCCESSFUL; + } + /* Ok, the mapping was not in the cache, give the remote map a second try. */ diff --git a/source/smbd/chgpasswd.c b/source/smbd/chgpasswd.c index af363d75a3f..c91f8599c96 100644 --- a/source/smbd/chgpasswd.c +++ b/source/smbd/chgpasswd.c @@ -456,7 +456,7 @@ BOOL chgpasswd(const char *name, const struct passwd *pass, DEBUG(3, ("chgpasswd: Password change (as_root=%s) for user: %s\n", BOOLSTR(as_root), name)); -#if DEBUG_PASSWORD +#ifdef DEBUG_PASSWORD DEBUG(100, ("chgpasswd: Passwords: old=%s new=%s\n", oldpass, newpass)); #endif @@ -1018,7 +1018,8 @@ NTSTATUS change_oem_password(SAM_ACCOUNT *hnd, char *old_passwd, char *new_passw return NT_STATUS_ACCOUNT_RESTRICTION; } - if (account_policy_get(AP_MIN_PASSWORD_LEN, &min_len) && (strlen(new_passwd) < min_len)) { + /* FIXME: AP_MIN_PASSWORD_LEN and lp_min_passwd_length() need to be merged - gd */ + if (account_policy_get(AP_MIN_PASSWORD_LEN, &min_len) && (str_charnum(new_passwd) < min_len)) { DEBUG(1, ("user %s cannot change password - password too short\n", username)); DEBUGADD(1, (" account policy min password len = %d\n", min_len)); @@ -1028,7 +1029,7 @@ NTSTATUS change_oem_password(SAM_ACCOUNT *hnd, char *old_passwd, char *new_passw /* Take the passed information and test it for minimum criteria */ /* Minimum password length */ - if (strlen(new_passwd) < lp_min_passwd_length()) { + if (str_charnum(new_passwd) < lp_min_passwd_length()) { /* too short, must be at least MINPASSWDLENGTH */ DEBUG(1, ("Password Change: user %s, New password is shorter than minimum password length = %d\n", username, lp_min_passwd_length())); diff --git a/source/smbd/close.c b/source/smbd/close.c index 6de27746442..4445f2516bc 100644 --- a/source/smbd/close.c +++ b/source/smbd/close.c @@ -150,6 +150,7 @@ static int close_normal_file(files_struct *fsp, BOOL normal_close) size_t share_entry_count = 0; BOOL delete_on_close = False; connection_struct *conn = fsp->conn; + int saved_errno = 0; int err = 0; int err1 = 0; @@ -160,8 +161,10 @@ static int close_normal_file(files_struct *fsp, BOOL normal_close) * error here, we must remember this. */ - if (close_filestruct(fsp) == -1) + if (close_filestruct(fsp) == -1) { + saved_errno = errno; err1 = -1; + } if (fsp->print_file) { print_fsp_end(fsp, normal_close); @@ -242,6 +245,12 @@ with error %s\n", fsp->fsp_name, strerror(errno) )); err = fd_close(conn, fsp); + /* Only save errno if fd_close failed and we don't already + have an errno saved from a flush call. */ + if ((err1 != -1) && (err == -1)) { + saved_errno = errno; + } + /* check for magic scripts */ if (normal_close) { check_magic(fsp,conn); @@ -252,24 +261,25 @@ with error %s\n", fsp->fsp_name, strerror(errno) )); */ if(fsp->pending_modtime) { - int saved_errno = errno; set_filetime(conn, fsp->fsp_name, fsp->pending_modtime); - errno = saved_errno; } DEBUG(2,("%s closed file %s (numopen=%d) %s\n", - conn->user,fsp->fsp_name, - conn->num_files_open, err ? strerror(err) : "")); + conn->user,fsp->fsp_name, + conn->num_files_open, + (err == -1 || err1 == -1) ? strerror(saved_errno) : "")); if (fsp->fsp_name) string_free(&fsp->fsp_name); file_free(fsp); - if (err == -1 || err1 == -1) - return errno; - else + if (err == -1 || err1 == -1) { + errno = saved_errno; + return saved_errno; + } else { return 0; + } } /**************************************************************************** diff --git a/source/smbd/dosmode.c b/source/smbd/dosmode.c index 33c75fffd53..7199b3ebbf3 100644 --- a/source/smbd/dosmode.c +++ b/source/smbd/dosmode.c @@ -135,8 +135,8 @@ uint32 dos_mode_from_sbuf(connection_struct *conn, SMB_STRUCT_STAT *sbuf) if (S_ISDIR(sbuf->st_mode)) result = aDIR | (result & aRONLY); -#if defined (HAVE_STAT_ST_BLOCKS) && defined (HAVE_STAT_ST_BLKSIZE) - if (sbuf->st_size > sbuf->st_blocks * (SMB_OFF_T)sbuf->st_blksize) { +#if defined (HAVE_STAT_ST_BLOCKS) && defined(STAT_ST_BLOCKSIZE) + if (sbuf->st_size > sbuf->st_blocks * (SMB_OFF_T)STAT_ST_BLOCKSIZE) { result |= FILE_ATTRIBUTE_SPARSE; } #endif diff --git a/source/smbd/fileio.c b/source/smbd/fileio.c index c2fb6e34566..b9fe1ad1cfc 100644 --- a/source/smbd/fileio.c +++ b/source/smbd/fileio.c @@ -151,10 +151,10 @@ ssize_t write_file(files_struct *fsp, char *data, SMB_OFF_T pos, size_t n) int write_path = -1; if (fsp->print_file) { - int snum; + fstring sharename; uint32 jobid; - if (!rap_to_pjobid(fsp->rap_print_jobid, &snum, &jobid)) { + if (!rap_to_pjobid(fsp->rap_print_jobid, sharename, &jobid)) { DEBUG(3,("write_file: Unable to map RAP jobid %u to jobid.\n", (unsigned int)fsp->rap_print_jobid )); errno = EBADF; diff --git a/source/smbd/files.c b/source/smbd/files.c index 80544c9a309..580dc545452 100644 --- a/source/smbd/files.c +++ b/source/smbd/files.c @@ -289,12 +289,12 @@ files_struct *file_find_fsp(files_struct *orig_fsp) { files_struct *fsp; - for (fsp=Files;fsp;fsp=fsp->next) { - if (fsp == orig_fsp) - return fsp; - } + for (fsp=Files;fsp;fsp=fsp->next) { + if (fsp == orig_fsp) + return fsp; + } - return NULL; + return NULL; } /**************************************************************************** @@ -303,16 +303,16 @@ files_struct *file_find_fsp(files_struct *orig_fsp) files_struct *file_find_di_first(SMB_DEV_T dev, SMB_INO_T inode) { - files_struct *fsp; + files_struct *fsp; - for (fsp=Files;fsp;fsp=fsp->next) { - if ( fsp->fd != -1 && - fsp->dev == dev && - fsp->inode == inode ) - return fsp; - } + for (fsp=Files;fsp;fsp=fsp->next) { + if ( fsp->fd != -1 && + fsp->dev == dev && + fsp->inode == inode ) + return fsp; + } - return NULL; + return NULL; } /**************************************************************************** @@ -321,16 +321,16 @@ files_struct *file_find_di_first(SMB_DEV_T dev, SMB_INO_T inode) files_struct *file_find_di_next(files_struct *start_fsp) { - files_struct *fsp; + files_struct *fsp; - for (fsp = start_fsp->next;fsp;fsp=fsp->next) { - if ( fsp->fd != -1 && - fsp->dev == start_fsp->dev && - fsp->inode == start_fsp->inode ) - return fsp; - } + for (fsp = start_fsp->next;fsp;fsp=fsp->next) { + if ( fsp->fd != -1 && + fsp->dev == start_fsp->dev && + fsp->inode == start_fsp->inode ) + return fsp; + } - return NULL; + return NULL; } /**************************************************************************** @@ -388,7 +388,9 @@ void file_free(files_struct *fsp) information */ ZERO_STRUCTP(fsp); - if (fsp == chain_fsp) chain_fsp = NULL; + if (fsp == chain_fsp) { + chain_fsp = NULL; + } SAFE_FREE(fsp); } diff --git a/source/smbd/lanman.c b/source/smbd/lanman.c index dd9708356e7..610ee451201 100644 --- a/source/smbd/lanman.c +++ b/source/smbd/lanman.c @@ -441,7 +441,7 @@ static void fill_printjob_info(connection_struct *conn, int snum, int uLevel, /* the client expects localtime */ t -= TimeDiff(t); - PACKI(desc,"W",pjobid_to_rap(snum,queue->job)); /* uJobId */ + PACKI(desc,"W",pjobid_to_rap(lp_const_servicename(snum),queue->job)); /* uJobId */ if (uLevel == 1) { PACKS(desc,"B21",queue->fs_user); /* szUserName */ PACKS(desc,"B",""); /* pad */ @@ -548,9 +548,8 @@ static void fill_printq_info_52(connection_struct *conn, int snum, PACKS(desc, "z", driver.info_3->datafile); /* Datafile name */ PACKS(desc, "z", driver.info_3->monitorname); /* language monitor */ - fstrcpy(location, "\\\\"); - fstrcat(location, get_called_name()); - fstrcat(location, "\\print$\\WIN40\\0"); + fstrcpy(location, "\\\\%L\\print$\\WIN40\\0"); + standard_sub_basic( "", location, sizeof(location)-1 ); PACKS(desc,"z", location); /* share to retrieve files */ PACKS(desc,"z", driver.info_3->defaultdatatype); /* default data type */ @@ -1501,10 +1500,12 @@ static BOOL api_RNetShareEnum( connection_struct *conn, if (!check_share_info(uLevel,str2)) return False; data_len = fixed_len = string_len = 0; - for (i=0;i<count;i++) + for (i=0;i<count;i++) { + fstring servicename_dos; + push_ascii_fstring(servicename_dos, lp_servicename(i)); if( lp_browseable( i ) && lp_snum_ok( i ) - && (strlen( lp_servicename( i ) ) < 13) ) /* Maximum name length. */ + && (strlen(servicename_dos) < 13) ) /* Maximum name length. */ { total++; data_len += fill_share_info(conn,i,uLevel,0,&f_len,0,&s_len,0); @@ -1517,6 +1518,7 @@ static BOOL api_RNetShareEnum( connection_struct *conn, else missed = True; } + } *rdata_len = fixed_len + string_len; *rdata = REALLOC(*rdata,*rdata_len); memset(*rdata,0,*rdata_len); @@ -1527,9 +1529,11 @@ static BOOL api_RNetShareEnum( connection_struct *conn, s_len = string_len; for( i = 0; i < count; i++ ) { + fstring servicename_dos; + push_ascii_fstring(servicename_dos, lp_servicename(i)); if( lp_browseable( i ) && lp_snum_ok( i ) - && (strlen( lp_servicename( i ) ) < 13) ) + && (strlen(servicename_dos) < 13) ) { if( fill_share_info( conn,i,uLevel,&p,&f_len,&p2,&s_len,*rdata ) < 0 ) break; @@ -2118,11 +2122,12 @@ static BOOL api_RDosPrintJobDel(connection_struct *conn,uint16 vuid, char *param char *p = skip_string(str2,1); uint32 jobid; int snum; + fstring sharename; int errcode; extern struct current_user current_user; WERROR werr = WERR_OK; - if(!rap_to_pjobid(SVAL(p,0),&snum,&jobid)) + if(!rap_to_pjobid(SVAL(p,0), sharename, &jobid)) return False; /* check it's a supported varient */ @@ -2133,7 +2138,7 @@ static BOOL api_RDosPrintJobDel(connection_struct *conn,uint16 vuid, char *param *rparam = REALLOC(*rparam,*rparam_len); *rdata_len = 0; - if (!print_job_exists(snum, jobid)) { + if (!print_job_exists(sharename, jobid)) { errcode = NERR_JobNotFound; goto out; } @@ -2253,11 +2258,12 @@ static BOOL api_PrintJobInfo(connection_struct *conn,uint16 vuid,char *param,cha char *p = skip_string(str2,1); uint32 jobid; int snum; + fstring sharename; int uLevel = SVAL(p,2); int function = SVAL(p,4); int place, errcode; - if(!rap_to_pjobid(SVAL(p,0),&snum,&jobid)) + if(!rap_to_pjobid(SVAL(p,0), sharename, &jobid)) return False; *rparam_len = 4; *rparam = REALLOC(*rparam,*rparam_len); @@ -2269,7 +2275,7 @@ static BOOL api_PrintJobInfo(connection_struct *conn,uint16 vuid,char *param,cha (!check_printjob_info(&desc,uLevel,str2))) return(False); - if (!print_job_exists(snum, jobid)) { + if (!print_job_exists(sharename, jobid)) { errcode=NERR_JobNotFound; goto out; } @@ -2935,6 +2941,7 @@ static BOOL api_WPrintJobGetInfo(connection_struct *conn,uint16 vuid, char *para int count; int i; int snum; + fstring sharename; uint32 jobid; struct pack_desc desc; print_queue_struct *queue=NULL; @@ -2952,7 +2959,7 @@ static BOOL api_WPrintJobGetInfo(connection_struct *conn,uint16 vuid, char *para if (strcmp(str1,"WWrLh") != 0) return False; if (!check_printjob_info(&desc,uLevel,str2)) return False; - if(!rap_to_pjobid(SVAL(p,0),&snum,&jobid)) + if(!rap_to_pjobid(SVAL(p,0), sharename, &jobid)) return False; if (snum < 0 || !VALID_SNUM(snum)) return(False); diff --git a/source/smbd/nttrans.c b/source/smbd/nttrans.c index d9e321fd968..eaaf68d6895 100644 --- a/source/smbd/nttrans.c +++ b/source/smbd/nttrans.c @@ -907,7 +907,7 @@ create_options = 0x%x root_dir_fid = 0x%x\n", flags, desired_access, file_attrib allocation_size |= (((SMB_BIG_UINT)IVAL(inbuf,smb_ntcreate_AllocationSize + 4)) << 32); #endif if (allocation_size && (allocation_size > (SMB_BIG_UINT)file_len)) { - fsp->initial_allocation_size = SMB_ROUNDUP(allocation_size,SMB_ROUNDUP_ALLOCATION_SIZE); + fsp->initial_allocation_size = smb_roundup(allocation_size); if (fsp->is_directory) { close_file(fsp,False); END_PROFILE(SMBntcreateX); @@ -920,7 +920,7 @@ create_options = 0x%x root_dir_fid = 0x%x\n", flags, desired_access, file_attrib return ERROR_NT(NT_STATUS_DISK_FULL); } } else { - fsp->initial_allocation_size = SMB_ROUNDUP(((SMB_BIG_UINT)file_len),SMB_ROUNDUP_ALLOCATION_SIZE); + fsp->initial_allocation_size = smb_roundup((SMB_BIG_UINT)file_len); } /* @@ -1429,7 +1429,7 @@ static int call_nt_transact_create(connection_struct *conn, char *inbuf, char *o allocation_size |= (((SMB_BIG_UINT)IVAL(params,16)) << 32); #endif if (allocation_size && (allocation_size > file_len)) { - fsp->initial_allocation_size = SMB_ROUNDUP(allocation_size,SMB_ROUNDUP_ALLOCATION_SIZE); + fsp->initial_allocation_size = smb_roundup(allocation_size); if (fsp->is_directory) { close_file(fsp,False); END_PROFILE(SMBntcreateX); @@ -1441,7 +1441,7 @@ static int call_nt_transact_create(connection_struct *conn, char *inbuf, char *o return ERROR_NT(NT_STATUS_DISK_FULL); } } else { - fsp->initial_allocation_size = SMB_ROUNDUP(((SMB_BIG_UINT)file_len),SMB_ROUNDUP_ALLOCATION_SIZE); + fsp->initial_allocation_size = smb_roundup((SMB_BIG_UINT)file_len); } /* Realloc the size of parameters and data we will return */ diff --git a/source/smbd/open.c b/source/smbd/open.c index 6d559ac8280..55970493fa1 100644 --- a/source/smbd/open.c +++ b/source/smbd/open.c @@ -1409,9 +1409,17 @@ flags=0x%X flags2=0x%X mode=0%o returned %d\n", } if (delete_on_close) { - NTSTATUS result = set_delete_on_close_internal(fsp, delete_on_close); + uint32 dosmode = existing_dos_mode; + NTSTATUS result; + + if (action == FILE_WAS_OVERWRITTEN || action == FILE_WAS_CREATED) { + dosmode = new_dos_mode; + } + result = set_delete_on_close_internal(fsp, delete_on_close, dosmode); if (NT_STATUS_V(result) != NT_STATUS_V(NT_STATUS_OK)) { + uint8 u_e_c; + uint32 u_e_code; /* Remember to delete the mode we just added. */ if (add_share_mode) { del_share_mode(fsp, NULL); @@ -1419,6 +1427,10 @@ flags=0x%X flags2=0x%X mode=0%o returned %d\n", unlock_share_entry_fsp(fsp); fd_close(conn,fsp); file_free(fsp); + ntstatus_to_dos(result, &u_e_c, &u_e_code); + unix_ERR_ntstatus = result; + unix_ERR_class = u_e_c; + unix_ERR_code = u_e_code; return NULL; } } @@ -1651,7 +1663,7 @@ files_struct *open_directory(connection_struct *conn, char *fname, SMB_STRUCT_ST string_set(&fsp->fsp_name,fname); if (delete_on_close) { - NTSTATUS result = set_delete_on_close_internal(fsp, delete_on_close); + NTSTATUS result = set_delete_on_close_internal(fsp, delete_on_close, 0); if (NT_STATUS_V(result) != NT_STATUS_V(NT_STATUS_OK)) { file_free(fsp); diff --git a/source/smbd/password.c b/source/smbd/password.c index cf3c3d64d20..eb389d7013d 100644 --- a/source/smbd/password.c +++ b/source/smbd/password.c @@ -473,7 +473,7 @@ BOOL authorise_login(int snum, fstring user, DATA_BLOB password, { BOOL ok = False; -#if DEBUG_PASSWORD +#ifdef DEBUG_PASSWORD DEBUG(100,("authorise_login: checking authorisation on user=%s pass=%s\n", user,password.data)); #endif diff --git a/source/smbd/posix_acls.c b/source/smbd/posix_acls.c index 95938b1e15c..ab32d0591e9 100644 --- a/source/smbd/posix_acls.c +++ b/source/smbd/posix_acls.c @@ -3195,6 +3195,7 @@ int get_acl_group_bits( connection_struct *conn, const char *fname, mode_t *mode int entry_id = SMB_ACL_FIRST_ENTRY; SMB_ACL_ENTRY_T entry; SMB_ACL_T posix_acl; + int result = -1; posix_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, fname, SMB_ACL_TYPE_ACCESS); if (posix_acl == (SMB_ACL_T)NULL) @@ -3209,20 +3210,22 @@ int get_acl_group_bits( connection_struct *conn, const char *fname, mode_t *mode entry_id = SMB_ACL_NEXT_ENTRY; if (SMB_VFS_SYS_ACL_GET_TAG_TYPE(conn, entry, &tagtype) ==-1) - return -1; + break; if (tagtype == SMB_ACL_GROUP_OBJ) { if (SMB_VFS_SYS_ACL_GET_PERMSET(conn, entry, &permset) == -1) { - return -1; + break; } else { *mode &= ~(S_IRGRP|S_IWGRP|S_IXGRP); *mode |= (SMB_VFS_SYS_ACL_GET_PERM(conn, permset, SMB_ACL_READ) ? S_IRGRP : 0); *mode |= (SMB_VFS_SYS_ACL_GET_PERM(conn, permset, SMB_ACL_WRITE) ? S_IWGRP : 0); *mode |= (SMB_VFS_SYS_ACL_GET_PERM(conn, permset, SMB_ACL_EXECUTE) ? S_IXGRP : 0); - return 0;; + result = 0; + break; } } } + SMB_VFS_SYS_ACL_FREE_ACL(conn, posix_acl); return -1; } diff --git a/source/smbd/reply.c b/source/smbd/reply.c index cdf607e2738..845f0588670 100644 --- a/source/smbd/reply.c +++ b/source/smbd/reply.c @@ -4514,13 +4514,18 @@ int reply_lockingX(connection_struct *conn, char *inbuf,char *outbuf,int length, data = smb_buf(inbuf); - if (locktype & (LOCKING_ANDX_CANCEL_LOCK | LOCKING_ANDX_CHANGE_LOCKTYPE)) { + if (locktype & LOCKING_ANDX_CHANGE_LOCKTYPE) { /* we don't support these - and CANCEL_LOCK makes w2k and XP reboot so I don't really want to be compatible! (tridge) */ return ERROR_NT(NT_STATUS_NOT_SUPPORTED); } + if (locktype & LOCKING_ANDX_CANCEL_LOCK) { + /* Need to make this like a cancel.... JRA. */ + return ERROR_NT(NT_STATUS_UNSUCCESSFUL); + } + /* Check if this is an oplock break on a file we have granted an oplock on. */ diff --git a/source/smbd/trans2.c b/source/smbd/trans2.c index f3176940c2f..9b1f2aa2105 100644 --- a/source/smbd/trans2.c +++ b/source/smbd/trans2.c @@ -31,20 +31,43 @@ extern uint32 global_client_caps; extern struct current_user current_user; #define get_file_size(sbuf) ((sbuf).st_size) +#define DIR_ENTRY_SAFETY_MARGIN 4096 + +/******************************************************************** + Roundup a value to the nearest SMB_ROUNDUP_ALLOCATION_SIZE boundary. + Only do this for Windows clients. +********************************************************************/ + +SMB_BIG_UINT smb_roundup(SMB_BIG_UINT val) +{ + /* Only roundup for Windows clients. */ + enum remote_arch_types ra_type = get_remote_arch(); + if ((ra_type != RA_SAMBA) && (ra_type != RA_CIFSFS)) { + val = SMB_ROUNDUP(val,SMB_ROUNDUP_ALLOCATION_SIZE); + } + return val; +} + +/******************************************************************** + Given a stat buffer return the allocated size on disk, taking into + account sparse files. +********************************************************************/ -/* given a stat buffer return the allocated size on disk, taking into - account sparse files */ SMB_BIG_UINT get_allocation_size(files_struct *fsp, SMB_STRUCT_STAT *sbuf) { SMB_BIG_UINT ret; + #if defined(HAVE_STAT_ST_BLOCKS) && defined(STAT_ST_BLOCKSIZE) ret = (SMB_BIG_UINT)STAT_ST_BLOCKSIZE * (SMB_BIG_UINT)sbuf->st_blocks; #else ret = (SMB_BIG_UINT)get_file_size(*sbuf); #endif + if (!ret && fsp && fsp->initial_allocation_size) ret = fsp->initial_allocation_size; - ret = SMB_ROUNDUP(ret,SMB_ROUNDUP_ALLOCATION_SIZE); + + ret = smb_roundup(ret); + return ret; } @@ -734,32 +757,6 @@ static uint32 unix_filetype(mode_t mode) } /**************************************************************************** - Return the major devicenumber for UNIX extensions. -****************************************************************************/ - -static uint32 unix_dev_major(SMB_DEV_T dev) -{ -#if defined(HAVE_DEVICE_MAJOR_FN) - return (uint32)major(dev); -#else - return (uint32)(dev >> 8); -#endif -} - -/**************************************************************************** - Return the minor devicenumber for UNIX extensions. -****************************************************************************/ - -static uint32 unix_dev_minor(SMB_DEV_T dev) -{ -#if defined(HAVE_DEVICE_MINOR_FN) - return (uint32)minor(dev); -#else - return (uint32)(dev & 0xff); -#endif -} - -/**************************************************************************** Map wire perms onto standard UNIX permissions. Obey share restrictions. ****************************************************************************/ @@ -1360,7 +1357,12 @@ static int call_trans2findfirst(connection_struct *conn, char *inbuf, char *outb close_if_end = %d requires_resume_key = %d level = 0x%x, max_data_bytes = %d\n", dirtype, maxentries, close_after_first, close_if_end, requires_resume_key, info_level, max_data_bytes)); - + + if (!maxentries) { + /* W2K3 seems to treat zero as 1. */ + maxentries = 1; + } + switch (info_level) { case SMB_INFO_STANDARD: case SMB_INFO_QUERY_EA_SIZE: @@ -1409,12 +1411,12 @@ close_if_end = %d requires_resume_key = %d level = 0x%x, max_data_bytes = %d\n", DEBUG(5,("dir=%s, mask = %s\n",directory, mask)); - pdata = Realloc(*ppdata, max_data_bytes + 1024); + pdata = Realloc(*ppdata, max_data_bytes + DIR_ENTRY_SAFETY_MARGIN); if( pdata == NULL ) return(ERROR_DOS(ERRDOS,ERRnomem)); *ppdata = pdata; - memset((char *)pdata,'\0',max_data_bytes + 1024); + memset((char *)pdata,'\0',max_data_bytes + DIR_ENTRY_SAFETY_MARGIN); /* Realloc the params space */ params = Realloc(*pparams, 10); @@ -1586,6 +1588,11 @@ resume_key = %d resume name = %s continue=%d level = %d\n", dptr_num, max_data_bytes, maxentries, close_after_request, close_if_end, requires_resume_key, resume_key, resume_name, continue_bit, info_level)); + if (!maxentries) { + /* W2K3 seems to treat zero as 1. */ + maxentries = 1; + } + switch (info_level) { case SMB_INFO_STANDARD: case SMB_INFO_QUERY_EA_SIZE: @@ -1602,12 +1609,12 @@ resume_key = %d resume name = %s continue=%d level = %d\n", return ERROR_DOS(ERRDOS,ERRunknownlevel); } - pdata = Realloc( *ppdata, max_data_bytes + 1024); + pdata = Realloc( *ppdata, max_data_bytes + DIR_ENTRY_SAFETY_MARGIN); if(pdata == NULL) return ERROR_DOS(ERRDOS,ERRnomem); *ppdata = pdata; - memset((char *)pdata,'\0',max_data_bytes + 1024); + memset((char *)pdata,'\0',max_data_bytes + DIR_ENTRY_SAFETY_MARGIN); /* Realloc the params space */ params = Realloc(*pparams, 6*SIZEOFWORD); @@ -1818,12 +1825,12 @@ static int call_trans2qfsinfo(connection_struct *conn, char *inbuf, char *outbuf return ERROR_DOS(ERRSRV,ERRinvdevice); } - pdata = Realloc(*ppdata, max_data_bytes + 1024); + pdata = Realloc(*ppdata, max_data_bytes + DIR_ENTRY_SAFETY_MARGIN); if ( pdata == NULL ) return ERROR_DOS(ERRDOS,ERRnomem); *ppdata = pdata; - memset((char *)pdata,'\0',max_data_bytes + 1024); + memset((char *)pdata,'\0',max_data_bytes + DIR_ENTRY_SAFETY_MARGIN); switch (info_level) { case SMB_INFO_ALLOCATION: @@ -2389,7 +2396,7 @@ static int call_trans2qfilepathinfo(connection_struct *conn, return ERROR_DOS(ERRDOS,ERRnomem); *pparams = params; memset((char *)params,'\0',2); - data_size = max_data_bytes + 1024; + data_size = max_data_bytes + DIR_ENTRY_SAFETY_MARGIN; pdata = Realloc(*ppdata, data_size); if ( pdata == NULL ) return ERROR_DOS(ERRDOS,ERRnomem); @@ -2804,25 +2811,38 @@ static int call_trans2qfilepathinfo(connection_struct *conn, open_file_shared. JRA. ****************************************************************************/ -NTSTATUS set_delete_on_close_internal(files_struct *fsp, BOOL delete_on_close) +NTSTATUS set_delete_on_close_internal(files_struct *fsp, BOOL delete_on_close, uint32 dosmode) { - /* - * Only allow delete on close for writable shares. - */ + if (delete_on_close) { + /* + * Only allow delete on close for writable files. + */ - if (delete_on_close && !CAN_WRITE(fsp->conn)) { - DEBUG(10,("set_delete_on_close_internal: file %s delete on close flag set but write access denied on share.\n", + if (dosmode & aRONLY) { + DEBUG(10,("set_delete_on_close_internal: file %s delete on close flag set but file attribute is readonly.\n", fsp->fsp_name )); - return NT_STATUS_ACCESS_DENIED; - } - /* - * Only allow delete on close for files/directories opened with delete intent. - */ + return NT_STATUS_CANNOT_DELETE; + } + + /* + * Only allow delete on close for writable shares. + */ + + if (!CAN_WRITE(fsp->conn)) { + DEBUG(10,("set_delete_on_close_internal: file %s delete on close flag set but write access denied on share.\n", + fsp->fsp_name )); + return NT_STATUS_ACCESS_DENIED; + } + + /* + * Only allow delete on close for files/directories opened with delete intent. + */ - if (delete_on_close && !(fsp->desired_access & DELETE_ACCESS)) { - DEBUG(10,("set_delete_on_close_internal: file %s delete on close flag set but delete access denied.\n", + if (!(fsp->desired_access & DELETE_ACCESS)) { + DEBUG(10,("set_delete_on_close_internal: file %s delete on close flag set but delete access denied.\n", fsp->fsp_name )); - return NT_STATUS_ACCESS_DENIED; + return NT_STATUS_ACCESS_DENIED; + } } if(fsp->is_directory) { @@ -2859,7 +2879,7 @@ NTSTATUS set_delete_on_close_over_all(files_struct *fsp, BOOL delete_on_close) return NT_STATUS_ACCESS_DENIED; if (!modify_delete_flag(fsp->dev, fsp->inode, delete_on_close)) { - DEBUG(0,("set_delete_on_close_internal: failed to change delete on close flag for file %s\n", + DEBUG(0,("set_delete_on_close_over_all: failed to change delete on close flag for file %s\n", fsp->fsp_name )); unlock_share_entry_fsp(fsp); return NT_STATUS_ACCESS_DENIED; @@ -3189,7 +3209,7 @@ static int call_trans2setfilepathinfo(connection_struct *conn, fname, (double)allocation_size )); if (allocation_size) - allocation_size = SMB_ROUNDUP(allocation_size,SMB_ROUNDUP_ALLOCATION_SIZE); + allocation_size = smb_roundup(allocation_size); if(allocation_size != get_file_size(sbuf)) { SMB_STRUCT_STAT new_sbuf; @@ -3279,7 +3299,7 @@ static int call_trans2setfilepathinfo(connection_struct *conn, if (fsp == NULL) return(UNIXERROR(ERRDOS,ERRbadfid)); - status = set_delete_on_close_internal(fsp, delete_on_close); + status = set_delete_on_close_internal(fsp, delete_on_close, dosmode); if (NT_STATUS_V(status) != NT_STATUS_V(NT_STATUS_OK)) return ERROR_NT(status); diff --git a/source/tdb/spinlock.c b/source/tdb/spinlock.c index 24c4371decc..a487ee2a103 100644 --- a/source/tdb/spinlock.c +++ b/source/tdb/spinlock.c @@ -27,7 +27,7 @@ #include <config.h> #endif -#if STANDALONE +#ifdef STANDALONE #include <stdlib.h> #include <stdio.h> #include <unistd.h> @@ -157,7 +157,7 @@ static inline int __spin_is_locked(spinlock_t *lock) * "sgi" and "_COMPILER_VERSION" are always defined by MIPSPro. */ -#if defined(STANDALONE) +#ifdef STANDALONE /* MIPSPro 7.3 has "__inline" as an extension, but not "inline. */ #define inline __inline diff --git a/source/tdb/tdb.c b/source/tdb/tdb.c index ae4e439c903..ceecbcb05dd 100644 --- a/source/tdb/tdb.c +++ b/source/tdb/tdb.c @@ -1007,26 +1007,12 @@ static tdb_off tdb_find(TDB_CONTEXT *tdb, TDB_DATA key, u32 hash, return TDB_ERRCODE(TDB_ERR_NOEXIST, 0); } -/* If they do lockkeys, check that this hash is one they locked */ -static int tdb_keylocked(TDB_CONTEXT *tdb, u32 hash) -{ - u32 i; - if (!tdb->lockedkeys) - return 1; - for (i = 0; i < tdb->lockedkeys[0]; i++) - if (tdb->lockedkeys[i+1] == hash) - return 1; - return TDB_ERRCODE(TDB_ERR_NOLOCK, 0); -} - /* As tdb_find, but if you succeed, keep the lock */ static tdb_off tdb_find_lock_hash(TDB_CONTEXT *tdb, TDB_DATA key, u32 hash, int locktype, struct list_struct *rec) { u32 rec_ptr; - if (!tdb_keylocked(tdb, hash)) - return 0; if (tdb_lock(tdb, BUCKET(hash), locktype) == -1) return 0; if (!(rec_ptr = tdb_find(tdb, key, hash, rec))) @@ -1228,10 +1214,6 @@ static int tdb_next_lock(TDB_CONTEXT *tdb, struct tdb_traverse_lock *tlock, { int want_next = (tlock->off != 0); - /* No traversal allows if you've called tdb_lockkeys() */ - if (tdb->lockedkeys) - return TDB_ERRCODE(TDB_ERR_NOLOCK, -1); - /* Lock each chain from the start one. */ for (; tlock->hash < tdb->header.hash_size; tlock->hash++) { if (tdb_lock(tdb, tlock->hash, F_WRLCK) == -1) @@ -1463,8 +1445,6 @@ int tdb_store(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, int flag) /* find which hash bucket it is in */ hash = tdb->hash_fn(&key); - if (!tdb_keylocked(tdb, hash)) - return -1; if (tdb_lock(tdb, BUCKET(hash), F_WRLCK) == -1) return -1; @@ -1581,8 +1561,6 @@ int tdb_append(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA new_dbuf) /* find which hash bucket it is in */ hash = tdb->hash_fn(&key); - if (!tdb_keylocked(tdb, hash)) - return -1; if (tdb_lock(tdb, BUCKET(hash), F_WRLCK) == -1) return -1; @@ -1725,7 +1703,6 @@ TDB_CONTEXT *tdb_open_ex(const char *name, int hash_size, int tdb_flags, tdb->fd = -1; tdb->name = NULL; tdb->map_ptr = NULL; - tdb->lockedkeys = NULL; tdb->flags = tdb_flags; tdb->open_flags = open_flags; tdb->log_fn = log_fn; @@ -1811,7 +1788,7 @@ TDB_CONTEXT *tdb_open_ex(const char *name, int hash_size, int tdb_flags, if (tdb_already_open(st.st_dev, st.st_ino)) { TDB_LOG((tdb, 2, "tdb_open_ex: " "%s (%d,%d) is already open in this process\n", - name, st.st_dev, st.st_ino)); + name, (int)st.st_dev, (int)st.st_ino)); errno = EBUSY; goto fail; } @@ -1913,7 +1890,6 @@ int tdb_close(TDB_CONTEXT *tdb) if (tdb->fd != -1) ret = close(tdb->fd); SAFE_FREE(tdb->locked); - SAFE_FREE(tdb->lockedkeys); /* Remove from contexts list */ for (i = &tdbs; *i; i = &(*i)->next) { @@ -1937,8 +1913,6 @@ int tdb_lockall(TDB_CONTEXT *tdb) /* There are no locks on read-only dbs */ if (tdb->read_only) return TDB_ERRCODE(TDB_ERR_LOCK, -1); - if (tdb->lockedkeys) - return TDB_ERRCODE(TDB_ERR_NOLOCK, -1); for (i = 0; i < tdb->header.hash_size; i++) if (tdb_lock(tdb, i, F_WRLCK)) break; @@ -1961,51 +1935,6 @@ void tdb_unlockall(TDB_CONTEXT *tdb) tdb_unlock(tdb, i, F_WRLCK); } -int tdb_lockkeys(TDB_CONTEXT *tdb, u32 number, TDB_DATA keys[]) -{ - u32 i, j, hash; - - /* Can't lock more keys if already locked */ - if (tdb->lockedkeys) - return TDB_ERRCODE(TDB_ERR_NOLOCK, -1); - if (!(tdb->lockedkeys = malloc(sizeof(u32) * (number+1)))) - return TDB_ERRCODE(TDB_ERR_OOM, -1); - /* First number in array is # keys */ - tdb->lockedkeys[0] = number; - - /* Insertion sort by bucket */ - for (i = 0; i < number; i++) { - hash = tdb->hash_fn(&keys[i]); - for (j = 0; j < i && BUCKET(tdb->lockedkeys[j+1]) < BUCKET(hash); j++); - memmove(&tdb->lockedkeys[j+2], &tdb->lockedkeys[j+1], sizeof(u32) * (i-j)); - tdb->lockedkeys[j+1] = hash; - } - /* Finally, lock in order */ - for (i = 0; i < number; i++) - if (tdb_lock(tdb, i, F_WRLCK)) - break; - - /* If error, release locks we have... */ - if (i < number) { - for ( j = 0; j < i; j++) - tdb_unlock(tdb, j, F_WRLCK); - SAFE_FREE(tdb->lockedkeys); - return TDB_ERRCODE(TDB_ERR_NOLOCK, -1); - } - return 0; -} - -/* Unlock the keys previously locked by tdb_lockkeys() */ -void tdb_unlockkeys(TDB_CONTEXT *tdb) -{ - u32 i; - if (!tdb->lockedkeys) - return; - for (i = 0; i < tdb->lockedkeys[0]; i++) - tdb_unlock(tdb, tdb->lockedkeys[i+1], F_WRLCK); - SAFE_FREE(tdb->lockedkeys); -} - /* lock/unlock one hash chain. This is meant to be used to reduce contention - it cannot guarantee how many records will be locked */ int tdb_chainlock(TDB_CONTEXT *tdb, TDB_DATA key) diff --git a/source/tdb/tdb.h b/source/tdb/tdb.h index e8a6d201c59..153b6e99232 100644 --- a/source/tdb/tdb.h +++ b/source/tdb/tdb.h @@ -107,7 +107,6 @@ typedef struct tdb_context { enum TDB_ERROR ecode; /* error code for last tdb error */ struct tdb_header header; /* a cached copy of the header */ u32 flags; /* the flags passed to tdb_open */ - u32 *lockedkeys; /* array of locked keys: first is #keys */ struct tdb_traverse_lock travlocks; /* current traversal locks */ struct tdb_context *next; /* all tdbs to avoid multiple opens */ dev_t device; /* uniquely identifies this tdb */ diff --git a/source/torture/cmd_vfs.c b/source/torture/cmd_vfs.c index bfce4b88b41..43661f1d6cb 100644 --- a/source/torture/cmd_vfs.c +++ b/source/torture/cmd_vfs.c @@ -538,8 +538,6 @@ static NTSTATUS cmd_stat(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, c printf(" Modify: %s", ctime(&(st.st_mtime))); printf(" Change: %s", ctime(&(st.st_ctime))); - SAFE_FREE(pwd); - SAFE_FREE(grp); return NT_STATUS_OK; } @@ -606,8 +604,6 @@ static NTSTATUS cmd_fstat(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, printf(" Modify: %s", ctime(&(st.st_mtime))); printf(" Change: %s", ctime(&(st.st_ctime))); - SAFE_FREE(pwd); - SAFE_FREE(grp); return NT_STATUS_OK; } @@ -662,8 +658,6 @@ static NTSTATUS cmd_lstat(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, printf(" Modify: %s", ctime(&(st.st_mtime))); printf(" Change: %s", ctime(&(st.st_ctime))); - SAFE_FREE(pwd); - SAFE_FREE(grp); return NT_STATUS_OK; } diff --git a/source/torture/masktest.c b/source/torture/masktest.c index 8c44f35f958..67515463d15 100644 --- a/source/torture/masktest.c +++ b/source/torture/masktest.c @@ -140,7 +140,7 @@ static BOOL reg_match_one(struct cli_state *cli, const char *pattern, const char if (strcmp(file,"..") == 0) file = "."; - return ms_fnmatch(pattern, file, cli->protocol, False /* not case sensitive */)==0; + return ms_fnmatch(pattern, file, cli->protocol, False) == 0; } static char *reg_test(struct cli_state *cli, char *pattern, char *long_name, char *short_name) diff --git a/source/utils/net.c b/source/utils/net.c index da1339aed10..2fe15c2b8ef 100644 --- a/source/utils/net.c +++ b/source/utils/net.c @@ -38,7 +38,7 @@ /*****************************************************/ #include "includes.h" -#include "../utils/net.h" +#include "utils/net.h" /***********************************************************************/ /* Beginning of internationalization section. Translatable constants */ @@ -69,7 +69,7 @@ int opt_port = 0; int opt_verbose = 0; int opt_maxusers = -1; const char *opt_comment = ""; -const char *opt_container = "cn=Users"; +const char *opt_container = NULL; int opt_flags = -1; int opt_timeout = 0; const char *opt_target_workgroup = NULL; @@ -697,6 +697,7 @@ static struct functable net_func[] = { {"MAXRID", net_maxrid}, {"IDMAP", net_idmap}, {"STATUS", net_status}, + {"USERSIDLIST", net_usersidlist}, #ifdef WITH_FAKE_KASERVER {"AFSKEY", net_afskey}, #endif diff --git a/source/utils/net.h b/source/utils/net.h index d75a19e498e..5e65ca0d4cd 100644 --- a/source/utils/net.h +++ b/source/utils/net.h @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include "../utils/net_proto.h" +#include "utils/net_proto.h" #define NET_FLAGS_MASTER 1 #define NET_FLAGS_DMB 2 diff --git a/source/utils/net_ads.c b/source/utils/net_ads.c index 2efd470bbe7..19311cde654 100644 --- a/source/utils/net_ads.c +++ b/source/utils/net_ads.c @@ -21,7 +21,7 @@ */ #include "includes.h" -#include "../utils/net.h" +#include "utils/net.h" #ifdef HAVE_ADS @@ -297,6 +297,10 @@ static int ads_user_add(int argc, const char **argv) goto done; } + if (opt_container == NULL) { + opt_container = ads_default_ou_string(ads, WELL_KNOWN_GUID_USERS); + } + status = ads_add_user_acct(ads, argv[0], opt_container, opt_comment); if (!ADS_ERR_OK(status)) { @@ -498,6 +502,10 @@ static int ads_group_add(int argc, const char **argv) goto done; } + if (opt_container == NULL) { + opt_container = ads_default_ou_string(ads, WELL_KNOWN_GUID_USERS); + } + status = ads_add_group_acct(ads, argv[0], opt_container, opt_comment); if (ADS_ERR_OK(status)) { @@ -690,7 +698,7 @@ int net_ads_join(int argc, const char **argv) char *password; char *machine_account = NULL; char *tmp_password; - const char *org_unit = "Computers"; + const char *org_unit = NULL; char *dn; void *res; DOM_SID dom_sid; @@ -728,7 +736,7 @@ int net_ads_join(int argc, const char **argv) return -1; } - ou_str = ads_ou_string(org_unit); + ou_str = ads_ou_string(ads,org_unit); asprintf(&dn, "%s,%s", ou_str, ads->config.bind_path); free(ou_str); @@ -847,7 +855,7 @@ int net_ads_printer_usage(int argc, const char **argv) { d_printf( "\nnet ads printer search <printer>" -"\n\tsearch for a printer in the directory" +"\n\tsearch for a printer in the directory\n" "\nnet ads printer info <printer> <server>" "\n\tlookup info in directory for printer on server" "\n\t(note: printer defaults to \"*\", server defaults to local)\n" diff --git a/source/utils/net_ads_cldap.c b/source/utils/net_ads_cldap.c index f3c6c5ff4d2..9585a8bc760 100644 --- a/source/utils/net_ads_cldap.c +++ b/source/utils/net_ads_cldap.c @@ -20,7 +20,7 @@ */ #include "includes.h" -#include "../utils/net.h" +#include "utils/net.h" #ifdef HAVE_ADS diff --git a/source/utils/net_groupmap.c b/source/utils/net_groupmap.c index 0ad1d519531..3431196b1e6 100644 --- a/source/utils/net_groupmap.c +++ b/source/utils/net_groupmap.c @@ -22,7 +22,7 @@ #include "includes.h" -#include "../utils/net.h" +#include "utils/net.h" /********************************************************* diff --git a/source/utils/net_help.c b/source/utils/net_help.c index d6ef5e8a6c3..cc5208b821f 100644 --- a/source/utils/net_help.c +++ b/source/utils/net_help.c @@ -19,7 +19,7 @@ */ #include "includes.h" -#include "../utils/net.h" +#include "utils/net.h" int net_common_methods_usage(int argc, const char**argv) { @@ -121,9 +121,14 @@ int net_help_share(int argc, const char **argv) "\tenumerates all exported resources (network shares) " "on target server\n\n" "net [<method>] share ADD <name=serverpath> [misc. options] [targets]" - "\n\tAdds a share from a server (makes the export active)\n\n" - "net [<method>] share DELETE <sharename> [misc. options] [targets]" - "\n\tDeletes a share from a server (makes the export inactive)\n\n" + "\n\tadds a share from a server (makes the export active)\n\n" + "net [<method>] share DELETE <sharename> [misc. options] [targets]" + "\n\tdeletes a share from a server (makes the export inactive)\n\n" + "net [<method>] share ALLOWEDUSERS [<filename>] " + "[misc. options] [targets]" + "\n\tshows a list of all shares together with all users allowed to" + "\n\taccess them. This needs the output of 'net usersidlist' on" + "\n\tstdin or in <filename>.\n" "net [<method>] share MIGRATE FILES <sharename> [misc. options] [targets]" "\n\tMigrates files from remote to local server\n\n" "net [<method>] share MIGRATE SHARES <sharename> [misc. options] [targets]" @@ -171,6 +176,9 @@ int net_help_printer(int argc, const char **argv) "\tlists all printers on print-server\n\n"); d_printf("net rpc printer DRIVER [printer] [misc. options] [targets]\n"\ "\tlists all printer-drivers on print-server\n\n"); + d_printf("net rpc printer PUBLISH action [printer] [misc. options] [targets]\n"\ + "\tpublishes printer settings in Active Directory\n" + "\taction can be one of PUBLISH, UPDATE, UNPUBLISH or LIST\n\n"); d_printf("net rpc printer MIGRATE PRINTERS [printer] [misc. options] [targets]"\ "\n\tmigrates printers from remote to local server\n\n"); d_printf("net rpc printer MIGRATE SETTINGS [printer] [misc. options] [targets]"\ @@ -217,6 +225,7 @@ static int net_usage(int argc, const char **argv) " net changesecretpw\tto change the machine password in the local secrets database only\n"\ " \tthis requires the -f flag as a safety barrier\n"\ " net status\t\tShow server status\n"\ + " net usersidlist\tto get a list of all users with their SIDs\n" "\n"\ " net ads <command>\tto run ADS commands\n"\ " net rap <command>\tto run RAP (pre-RPC) commands\n"\ @@ -254,6 +263,7 @@ int net_help(int argc, const char **argv) {"PASSWORD", net_rap_password_usage}, {"TIME", net_time_usage}, {"LOOKUP", net_lookup_usage}, + {"USERSIDLIST", net_usersidlist_usage}, #ifdef WITH_FAKE_KASERVER {"AFSKEY", net_afskey_usage}, #endif diff --git a/source/utils/net_idmap.c b/source/utils/net_idmap.c index f5b4bf1b4a7..35892e8b52c 100644 --- a/source/utils/net_idmap.c +++ b/source/utils/net_idmap.c @@ -18,7 +18,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "includes.h" -#include "../utils/net.h" +#include "utils/net.h" /*********************************************************** diff --git a/source/utils/net_lookup.c b/source/utils/net_lookup.c index cef0ea5fbed..7e5f12da454 100644 --- a/source/utils/net_lookup.c +++ b/source/utils/net_lookup.c @@ -18,7 +18,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "includes.h" -#include "../utils/net.h" +#include "utils/net.h" int net_lookup_usage(int argc, const char **argv) { diff --git a/source/utils/net_rap.c b/source/utils/net_rap.c index 39254641abf..cae0a7f7da8 100644 --- a/source/utils/net_rap.c +++ b/source/utils/net_rap.c @@ -24,7 +24,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "includes.h" -#include "../utils/net.h" +#include "utils/net.h" /* The following messages were for error checking that is not properly reported at the moment. Which should be reinstated? */ diff --git a/source/utils/net_rpc.c b/source/utils/net_rpc.c index 1a1d76b09a0..295c8c5853f 100644 --- a/source/utils/net_rpc.c +++ b/source/utils/net_rpc.c @@ -3,6 +3,7 @@ Distributed SMB/CIFS Server Management Utility Copyright (C) 2001 Andrew Bartlett (abartlet@samba.org) Copyright (C) 2002 Jim McDonough (jmcd@us.ibm.com) + Copyright (C) 2004 Guenther Deschner (gd@samba.org) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,7 +20,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "includes.h" -#include "../utils/net.h" +#include "utils/net.h" /** * @file net_rpc.c @@ -2973,6 +2974,784 @@ static int rpc_share_migrate(int argc, const char **argv) return net_run_function(argc, argv, func, rpc_share_usage); } +struct full_alias { + DOM_SID sid; + int num_members; + DOM_SID *members; +}; + +static int num_server_aliases; +static struct full_alias *server_aliases; + +/* + * Add an alias to the static list. + */ +static void push_alias(TALLOC_CTX *mem_ctx, struct full_alias *alias) +{ + if (server_aliases == NULL) + server_aliases = malloc(100 * sizeof(struct full_alias)); + + server_aliases[num_server_aliases] = *alias; + num_server_aliases += 1; +} + +/* + * For a specific domain on the server, fetch all the aliases + * and their members. Add all of them to the server_aliases. + */ +static NTSTATUS +rpc_fetch_domain_aliases(struct cli_state *cli, TALLOC_CTX *mem_ctx, + POLICY_HND *connect_pol, + const DOM_SID *domain_sid) +{ + uint32 start_idx, max_entries, num_entries, i; + struct acct_info *groups; + NTSTATUS result; + POLICY_HND domain_pol; + + /* Get domain policy handle */ + + result = cli_samr_open_domain(cli, mem_ctx, connect_pol, + MAXIMUM_ALLOWED_ACCESS, + domain_sid, &domain_pol); + if (!NT_STATUS_IS_OK(result)) + return result; + + start_idx = 0; + max_entries = 250; + + do { + result = cli_samr_enum_als_groups(cli, mem_ctx, &domain_pol, + &start_idx, max_entries, + &groups, &num_entries); + + for (i = 0; i < num_entries; i++) { + + POLICY_HND alias_pol; + struct full_alias alias; + DOM_SID *members; + int j; + + result = cli_samr_open_alias(cli, mem_ctx, &domain_pol, + MAXIMUM_ALLOWED_ACCESS, + groups[i].rid, + &alias_pol); + if (!NT_STATUS_IS_OK(result)) + goto done; + + result = cli_samr_query_aliasmem(cli, mem_ctx, + &alias_pol, + &alias.num_members, + &members); + if (!NT_STATUS_IS_OK(result)) + goto done; + + result = cli_samr_close(cli, mem_ctx, &alias_pol); + if (!NT_STATUS_IS_OK(result)) + goto done; + + alias.members = NULL; + + if (alias.num_members > 0) { + alias.members = malloc(alias.num_members * + sizeof(DOM_SID)); + + for (j = 0; j < alias.num_members; j++) + sid_copy(&alias.members[j], + &members[j]); + } + + sid_copy(&alias.sid, domain_sid); + sid_append_rid(&alias.sid, groups[i].rid); + + push_alias(mem_ctx, &alias); + } + } while (NT_STATUS_EQUAL(result, STATUS_MORE_ENTRIES)); + + result = NT_STATUS_OK; + + done: + cli_samr_close(cli, mem_ctx, &domain_pol); + + return result; +} + +/* + * Dump server_aliases as names for debugging purposes. + */ +static NTSTATUS +rpc_aliaslist_dump(const DOM_SID *domain_sid, const char *domain_name, + struct cli_state *cli, TALLOC_CTX *mem_ctx, + int argc, const char **argv) +{ + int i; + NTSTATUS result; + POLICY_HND lsa_pol; + + result = cli_lsa_open_policy(cli, mem_ctx, True, + SEC_RIGHTS_MAXIMUM_ALLOWED, + &lsa_pol); + if (!NT_STATUS_IS_OK(result)) + return result; + + for (i=0; i<num_server_aliases; i++) { + char **names; + char **domains; + uint32 *types; + int j; + + struct full_alias *alias = &server_aliases[i]; + + result = cli_lsa_lookup_sids(cli, mem_ctx, &lsa_pol, 1, + &alias->sid, + &domains, &names, &types); + if (!NT_STATUS_IS_OK(result)) + continue; + + DEBUG(1, ("%s\\%s %d: ", domains[0], names[0], types[0])); + + if (alias->num_members == 0) { + DEBUG(1, ("\n")); + continue; + } + + result = cli_lsa_lookup_sids(cli, mem_ctx, &lsa_pol, + alias->num_members, + alias->members, + &domains, &names, &types); + + if (!NT_STATUS_IS_OK(result) && + !NT_STATUS_EQUAL(result, STATUS_SOME_UNMAPPED)) + continue; + + for (j=0; j<alias->num_members; j++) + DEBUG(1, ("%s\\%s (%d); ", + domains[j] ? domains[j] : "*unknown*", + names[j] ? names[j] : "*unknown*",types[j])); + DEBUG(1, ("\n")); + } + + cli_lsa_close(cli, mem_ctx, &lsa_pol); + + return NT_STATUS_OK; +} + +/* + * Fetch a list of all server aliases and their members into + * server_aliases. + */ +static NTSTATUS +rpc_aliaslist_internals(const DOM_SID *domain_sid, const char *domain_name, + struct cli_state *cli, TALLOC_CTX *mem_ctx, + int argc, const char **argv) +{ + NTSTATUS result; + POLICY_HND connect_pol; + DOM_SID global_sid_Builtin; + + result = cli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS, + &connect_pol); + + if (!NT_STATUS_IS_OK(result)) + goto done; + + string_to_sid(&global_sid_Builtin, "S-1-5-32"); + + result = rpc_fetch_domain_aliases(cli, mem_ctx, &connect_pol, + &global_sid_Builtin); + + if (!NT_STATUS_IS_OK(result)) + goto done; + + result = rpc_fetch_domain_aliases(cli, mem_ctx, &connect_pol, + domain_sid); + + cli_samr_close(cli, mem_ctx, &connect_pol); + done: + return result; +} + +static void init_user_token(NT_USER_TOKEN *token, DOM_SID *user_sid) +{ + DOM_SID global_sid_World; + DOM_SID global_sid_Network; + DOM_SID global_sid_Authenticated_Users; + + string_to_sid(&global_sid_World, "S-1-1-0"); + string_to_sid(&global_sid_Network, "S-1-5-2"); + string_to_sid(&global_sid_Authenticated_Users, "S-1-5-11"); + + token->num_sids = 4; + + token->user_sids = malloc(4 * sizeof(DOM_SID)); + + token->user_sids[0] = *user_sid; + sid_copy(&token->user_sids[1], &global_sid_World); + sid_copy(&token->user_sids[2], &global_sid_Network); + sid_copy(&token->user_sids[3], &global_sid_Authenticated_Users); +} + +static void free_user_token(NT_USER_TOKEN *token) +{ + SAFE_FREE(token->user_sids); +} + +static BOOL is_sid_in_token(NT_USER_TOKEN *token, DOM_SID *sid) +{ + int i; + + for (i=0; i<token->num_sids; i++) { + if (sid_compare(sid, &token->user_sids[i]) == 0) + return True; + } + return False; +} + +static void add_sid_to_token(NT_USER_TOKEN *token, DOM_SID *sid) +{ + if (is_sid_in_token(token, sid)) + return; + + token->user_sids = Realloc(token->user_sids, + (token->num_sids+1) * sizeof(DOM_SID)); + + sid_copy(&token->user_sids[token->num_sids], sid); + + token->num_sids += 1; +} + +struct user_token { + fstring name; + NT_USER_TOKEN token; +}; + +static void dump_user_token(struct user_token *token) +{ + int i; + + d_printf("%s\n", token->name); + + for (i=0; i<token->token.num_sids; i++) { + d_printf(" %s\n", sid_string_static(&token->token.user_sids[i])); + } +} + +static BOOL is_alias_member(DOM_SID *sid, struct full_alias *alias) +{ + int i; + + for (i=0; i<alias->num_members; i++) { + if (sid_compare(sid, &alias->members[i]) == 0) + return True; + } + + return False; +} + +static void collect_sid_memberships(NT_USER_TOKEN *token, DOM_SID sid) +{ + int i; + + for (i=0; i<num_server_aliases; i++) { + if (is_alias_member(&sid, &server_aliases[i])) + add_sid_to_token(token, &server_aliases[i].sid); + } +} + +/* + * We got a user token with all the SIDs we can know about without asking the + * server directly. These are the user and domain group sids. All of these can + * be members of aliases. So scan the list of aliases for each of the SIDs and + * add them to the token. + */ + +static void collect_alias_memberships(NT_USER_TOKEN *token) +{ + int num_global_sids = token->num_sids; + int i; + + for (i=0; i<num_global_sids; i++) { + collect_sid_memberships(token, token->user_sids[i]); + } +} + +static BOOL get_user_sids(const char *domain, const char *user, + NT_USER_TOKEN *token) +{ + struct winbindd_request request; + struct winbindd_response response; + fstring full_name; + NSS_STATUS result; + + DOM_SID user_sid; + + int i; + + fstr_sprintf(full_name, "%s%c%s", + domain, *lp_winbind_separator(), user); + + /* First let's find out the user sid */ + + ZERO_STRUCT(request); + ZERO_STRUCT(response); + + fstrcpy(request.data.name.dom_name, domain); + fstrcpy(request.data.name.name, user); + + result = winbindd_request(WINBINDD_LOOKUPNAME, &request, &response); + + if (result != NSS_STATUS_SUCCESS) { + DEBUG(1, ("winbind could not find %s\n", full_name)); + return False; + } + + if (response.data.sid.type != SID_NAME_USER) { + DEBUG(1, ("%s is not a user\n", full_name)); + return False; + } + + string_to_sid(&user_sid, response.data.sid.sid); + + init_user_token(token, &user_sid); + + /* And now the groups winbind knows about */ + + ZERO_STRUCT(response); + + fstrcpy(request.data.username, full_name); + + result = winbindd_request(WINBINDD_GETGROUPS, &request, &response); + + if (result != NSS_STATUS_SUCCESS) { + DEBUG(1, ("winbind could not get groups of %s\n", full_name)); + return False; + } + + for (i = 0; i < response.data.num_entries; i++) { + gid_t gid = ((gid_t *)response.extra_data)[i]; + DOM_SID sid; + + struct winbindd_request sidrequest; + struct winbindd_response sidresponse; + + ZERO_STRUCT(sidrequest); + ZERO_STRUCT(sidresponse); + + sidrequest.data.gid = gid; + + result = winbindd_request(WINBINDD_GID_TO_SID, + &sidrequest, &sidresponse); + + if (result != NSS_STATUS_SUCCESS) { + DEBUG(1, ("winbind could not find SID of gid %d\n", + gid)); + return False; + } + + DEBUG(3, (" %s\n", sidresponse.data.sid.sid)); + + string_to_sid(&sid, sidresponse.data.sid.sid); + add_sid_to_token(token, &sid); + } + + SAFE_FREE(response.extra_data); + + return True; +} + +/** + * Get a list of all user tokens we want to look at + **/ +static BOOL get_user_tokens(int *num_tokens, struct user_token **user_tokens) +{ + struct winbindd_request request; + struct winbindd_response response; + const char *extra_data; + fstring name; + int i; + struct user_token *result; + + /* Send request to winbind daemon */ + + ZERO_STRUCT(request); + ZERO_STRUCT(response); + + if (winbindd_request(WINBINDD_LIST_USERS, &request, &response) != + NSS_STATUS_SUCCESS) + return False; + + /* Look through extra data */ + + if (!response.extra_data) + return False; + + extra_data = (const char *)response.extra_data; + *num_tokens = 0; + + while(next_token(&extra_data, name, ",", sizeof(fstring))) { + *num_tokens += 1; + } + + result = malloc(*num_tokens * sizeof(struct user_token)); + + if (result == NULL) { + DEBUG(1, ("Could not malloc sid array\n")); + return False; + } + + extra_data = (const char *)response.extra_data; + i=0; + + while(next_token(&extra_data, name, ",", sizeof(fstring))) { + + fstring domain, user; + char *p; + + fstrcpy(result[i].name, name); + + p = strchr(name, *lp_winbind_separator()); + + DEBUG(3, ("%s\n", name)); + + if (p == NULL) + continue; + + *p++ = '\0'; + + fstrcpy(domain, name); + strupper_m(domain); + fstrcpy(user, p); + + get_user_sids(domain, user, &(result[i].token)); + i+=1; + } + + SAFE_FREE(response.extra_data); + + *user_tokens = result; + + return True; +} + +static BOOL get_user_tokens_from_file(FILE *f, + int *num_tokens, + struct user_token **tokens) +{ + struct user_token *token = NULL; + + while (!feof(f)) { + fstring line; + + if (fgets(line, sizeof(line)-1, f) == NULL) { + return True; + } + + if (line[strlen(line)-1] == '\n') + line[strlen(line)-1] = '\0'; + + if (line[0] == ' ') { + /* We have a SID */ + + DOM_SID sid; + string_to_sid(&sid, &line[1]); + + if (token == NULL) { + DEBUG(0, ("File does not begin with username")); + return False; + } + + add_sid_to_token(&token->token, &sid); + continue; + } + + /* And a new user... */ + + *num_tokens += 1; + *tokens = Realloc(*tokens, + *num_tokens * + sizeof(struct user_token)); + if (*tokens == NULL) { + DEBUG(0, ("Could not realloc tokens\n")); + return False; + } + + token = &((*tokens)[*num_tokens-1]); + + fstrcpy(token->name, line); + token->token.num_sids = 0; + token->token.user_sids = NULL; + continue; + } + + return False; +} + + +/* + * Show the list of all users that have access to a share + */ + +static void show_userlist(struct cli_state *cli, + TALLOC_CTX *mem_ctx, const char *netname, + int num_tokens, struct user_token *tokens) +{ + int fnum; + SEC_DESC *share_sd = NULL; + SEC_DESC *root_sd = NULL; + int i; + SRV_SHARE_INFO info; + WERROR result; + uint16 cnum; + + result = cli_srvsvc_net_share_get_info(cli, mem_ctx, netname, + 502, &info); + + if (!W_ERROR_IS_OK(result)) { + DEBUG(1, ("Coult not query secdesc for share %s\n", + netname)); + return; + } + + share_sd = info.share.info502.info_502_str.sd; + if (share_sd == NULL) { + DEBUG(1, ("Got no secdesc for share %s\n", + netname)); + } + + cnum = cli->cnum; + + if (!cli_send_tconX(cli, netname, "A:", "", 0)) { + return; + } + + fnum = cli_nt_create(cli, "\\", READ_CONTROL_ACCESS); + + if (fnum != -1) { + root_sd = cli_query_secdesc(cli, fnum, mem_ctx); + } + + for (i=0; i<num_tokens; i++) { + uint32 acc_granted; + NTSTATUS status; + + if (share_sd != NULL) { + if (!se_access_check(share_sd, &tokens[i].token, + 1, &acc_granted, &status)) { + DEBUG(1, ("Could not check share_sd for " + "user %s\n", + tokens[i].name)); + continue; + } + + if (!NT_STATUS_IS_OK(status)) + continue; + } + + if (root_sd == NULL) { + d_printf(" %s\n", tokens[i].name); + continue; + } + + if (!se_access_check(root_sd, &tokens[i].token, + 1, &acc_granted, &status)) { + DEBUG(1, ("Could not check root_sd for user %s\n", + tokens[i].name)); + continue; + } + + if (!NT_STATUS_IS_OK(status)) + continue; + + d_printf(" %s\n", tokens[i].name); + } + + if (fnum != -1) + cli_close(cli, fnum); + cli_tdis(cli); + cli->cnum = cnum; + + return; +} + +struct share_list { + int num_shares; + char **shares; +}; + +static void collect_share(const char *name, uint32 m, + const char *comment, void *state) +{ + struct share_list *share_list = (struct share_list *)state; + + if (m != STYPE_DISKTREE) + return; + + share_list->num_shares += 1; + share_list->shares = Realloc(share_list->shares, + share_list->num_shares * sizeof(char *)); + share_list->shares[share_list->num_shares-1] = strdup(name); +} + +static void rpc_share_userlist_usage(void) +{ + return; +} + +/** + * List shares on a remote RPC server, including the security descriptors + * + * All parameters are provided by the run_rpc_command function, except for + * argc, argv which are passes through. + * + * @param domain_sid The domain sid acquired from the remote server + * @param cli A cli_state connected to the server. + * @param mem_ctx Talloc context, destoyed on completion of the function. + * @param argc Standard main() style argc + * @param argv Standard main() style argv. Initial components are already + * stripped + * + * @return Normal NTSTATUS return. + **/ + +static NTSTATUS +rpc_share_allowedusers_internals(const DOM_SID *domain_sid, + const char *domain_name, + struct cli_state *cli, + TALLOC_CTX *mem_ctx, + int argc, const char **argv) +{ + int ret; + BOOL r; + ENUM_HND hnd; + uint32 i; + FILE *f; + + struct user_token *tokens = NULL; + int num_tokens = 0; + + struct share_list share_list; + + if (argc > 1) { + rpc_share_userlist_usage(); + return NT_STATUS_UNSUCCESSFUL; + } + + if (argc == 0) { + f = stdin; + } else { + f = fopen(argv[0], "r"); + } + + if (f == NULL) { + DEBUG(0, ("Could not open userlist: %s\n", strerror(errno))); + return NT_STATUS_UNSUCCESSFUL; + } + + r = get_user_tokens_from_file(f, &num_tokens, &tokens); + + if (f != stdin) + fclose(f); + + if (!r) { + DEBUG(0, ("Could not read users from file\n")); + return NT_STATUS_UNSUCCESSFUL; + } + + for (i=0; i<num_tokens; i++) + collect_alias_memberships(&tokens[i].token); + + init_enum_hnd(&hnd, 0); + + share_list.num_shares = 0; + share_list.shares = NULL; + + ret = cli_RNetShareEnum(cli, collect_share, &share_list); + + if (ret == -1) { + DEBUG(0, ("Error returning browse list: %s\n", + cli_errstr(cli))); + goto done; + } + + for (i = 0; i < share_list.num_shares; i++) { + char *netname = share_list.shares[i]; + + if (netname[strlen(netname)-1] == '$') + continue; + + d_printf("%s\n", netname); + + show_userlist(cli, mem_ctx, netname, + num_tokens, tokens); + } + done: + for (i=0; i<num_tokens; i++) { + free_user_token(&tokens[i].token); + } + SAFE_FREE(tokens); + SAFE_FREE(share_list.shares); + + return NT_STATUS_OK; +} + +static int +rpc_share_allowedusers(int argc, const char **argv) +{ + int result; + + result = run_rpc_command(NULL, PI_SAMR, 0, + rpc_aliaslist_internals, + argc, argv); + if (result != 0) + return result; + + result = run_rpc_command(NULL, PI_LSARPC, 0, + rpc_aliaslist_dump, + argc, argv); + if (result != 0) + return result; + + return run_rpc_command(NULL, PI_SRVSVC, 0, + rpc_share_allowedusers_internals, + argc, argv); +} + +int net_usersidlist(int argc, const char **argv) +{ + int num_tokens = 0; + struct user_token *tokens = NULL; + int i; + + if (argc != 0) { + net_usersidlist_usage(argc, argv); + return 0; + } + + if (!get_user_tokens(&num_tokens, &tokens)) { + DEBUG(0, ("Could not get the user/sid list\n")); + return 0; + } + + for (i=0; i<num_tokens; i++) { + dump_user_token(&tokens[i]); + free_user_token(&tokens[i].token); + } + + SAFE_FREE(tokens); + return 1; +} + +int net_usersidlist_usage(int argc, const char **argv) +{ + d_printf("net usersidlist\n" + "\tprints out a list of all users the running winbind knows\n" + "\tabout, together with all their SIDs. This is used as\n" + "\tinput to the 'net rpc share allowedusers' command.\n\n"); + + net_common_flags_usage(argc, argv); + return -1; +} + /** * 'net rpc share' entrypoint. * @param argc Standard main() style argc @@ -2985,6 +3764,7 @@ int net_rpc_share(int argc, const char **argv) struct functable func[] = { {"add", rpc_share_add}, {"delete", rpc_share_delete}, + {"allowedusers", rpc_share_allowedusers}, {"migrate", rpc_share_migrate}, {NULL, NULL} }; @@ -4266,6 +5046,106 @@ static int rpc_printer_driver_list(int argc, const char **argv) } /** + * Publish printer in ADS via MSRPC + * + * @param argc Standard main() style argc + * @param argv Standard main() style argv. Initial components are already + * stripped + * + * @return A shell status integer (0 for success) + **/ +static int rpc_printer_publish_publish(int argc, const char **argv) +{ + + return run_rpc_command(NULL, PI_SPOOLSS, 0, + rpc_printer_publish_publish_internals, + argc, argv); +} + +/** + * Update printer in ADS via MSRPC + * + * @param argc Standard main() style argc + * @param argv Standard main() style argv. Initial components are already + * stripped + * + * @return A shell status integer (0 for success) + **/ +static int rpc_printer_publish_update(int argc, const char **argv) +{ + + return run_rpc_command(NULL, PI_SPOOLSS, 0, + rpc_printer_publish_update_internals, + argc, argv); +} + +/** + * UnPublish printer in ADS via MSRPC + * + * @param argc Standard main() style argc + * @param argv Standard main() style argv. Initial components are already + * stripped + * + * @return A shell status integer (0 for success) + **/ +static int rpc_printer_publish_unpublish(int argc, const char **argv) +{ + + return run_rpc_command(NULL, PI_SPOOLSS, 0, + rpc_printer_publish_unpublish_internals, + argc, argv); +} + +/** + * List published printers via MSRPC + * + * @param argc Standard main() style argc + * @param argv Standard main() style argv. Initial components are already + * stripped + * + * @return A shell status integer (0 for success) + **/ +static int rpc_printer_publish_list(int argc, const char **argv) +{ + + return run_rpc_command(NULL, PI_SPOOLSS, 0, + rpc_printer_publish_list_internals, + argc, argv); +} + + +/** + * Publish printer in ADS + * + * @param argc Standard main() style argc + * @param argv Standard main() style argv. Initial components are already + * stripped + * + * @return A shell status integer (0 for success) + **/ +static int rpc_printer_publish(int argc, const char **argv) +{ + + struct functable func[] = { + {"publish", rpc_printer_publish_publish}, + {"update", rpc_printer_publish_update}, + {"unpublish", rpc_printer_publish_unpublish}, + {"list", rpc_printer_publish_list}, + {"help", rpc_printer_usage}, + {NULL, NULL} + }; + + if (argc == 0) + return run_rpc_command(NULL, PI_SPOOLSS, 0, + rpc_printer_publish_list_internals, + argc, argv); + + return net_run_function(argc, argv, func, rpc_printer_usage); + +} + + +/** * Display rpc printer help page. * @param argc Standard main() style argc * @param argv Standard main() style argv. Initial components are already @@ -4288,6 +5168,7 @@ int net_rpc_printer(int argc, const char **argv) {"list", rpc_printer_list}, {"migrate", rpc_printer_migrate}, {"driver", rpc_printer_driver_list}, + {"publish", rpc_printer_publish}, {NULL, NULL} }; @@ -4316,7 +5197,7 @@ int net_rpc_usage(int argc, const char **argv) d_printf(" net rpc oldjoin \t\t\tto join a domain created in server manager\n\n\n"); d_printf(" net rpc testjoin \t\ttests that a join is valid\n"); d_printf(" net rpc user \t\t\tto add, delete and list users\n"); - d_printf(" net rpc password <username> [<password>] -Uadmin_username%%admin_pass"); + d_printf(" net rpc password <username> [<password>] -Uadmin_username%%admin_pass\n"); d_printf(" net rpc group \t\tto list groups\n"); d_printf(" net rpc share \t\tto add, delete, list and migrate shares\n"); d_printf(" net rpc printer \t\tto list and migrate printers\n"); diff --git a/source/utils/net_rpc_join.c b/source/utils/net_rpc_join.c index 52e295949e0..cb8a5ee4d4f 100644 --- a/source/utils/net_rpc_join.c +++ b/source/utils/net_rpc_join.c @@ -19,7 +19,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "includes.h" -#include "../utils/net.h" +#include "utils/net.h" /* Macro for checking RPC error codes to make things more readable */ diff --git a/source/utils/net_rpc_printer.c b/source/utils/net_rpc_printer.c index 51f4df7b05a..a7e0ebeb6ca 100644 --- a/source/utils/net_rpc_printer.c +++ b/source/utils/net_rpc_printer.c @@ -18,7 +18,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "includes.h" -#include "../utils/net.h" +#include "utils/net.h" struct table_node { const char *long_archi; @@ -32,10 +32,12 @@ static const struct table_node archi_table[]= { {"Windows 4.0", "WIN40", 0 }, {"Windows NT x86", "W32X86", 2 }, + {"Windows NT x86", "W32X86", 3 }, {"Windows NT R4000", "W32MIPS", 2 }, {"Windows NT Alpha_AXP", "W32ALPHA", 2 }, {"Windows NT PowerPC", "W32PPC", 2 }, - {"Windows IA64", "IA64", 3 }, + {"Windows IA64", "IA64", 3 }, + {"Windows x64", "x64", 3 }, {NULL, "", -1 } }; @@ -839,38 +841,41 @@ net_spoolss_enum_printers(struct cli_state *cli, TALLOC_CTX *mem_ctx, static BOOL net_spoolss_open_printer_ex(struct cli_state *cli, TALLOC_CTX *mem_ctx, - const char *printername, const char *datatype, - uint32 access_required, const char *servername, + const char *printername, uint32 access_required, const char *username, POLICY_HND *hnd) { WERROR result; + fstring servername, printername2; - fstring servername2; - slprintf(servername2, sizeof(servername2)-1, "\\\\%s", cli->desthost); + slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->desthost); + + fstrcpy(printername2, servername); + fstrcat(printername2, "\\"); + fstrcat(printername2, printername); DEBUG(10,("connecting to: %s as %s for %s and access: %x\n", - servername2, username, printername, access_required)); + servername, username, printername2, access_required)); /* open printer */ - result = cli_spoolss_open_printer_ex(cli, mem_ctx, printername, + result = cli_spoolss_open_printer_ex(cli, mem_ctx, printername2, "", access_required, - servername2, username, hnd); + servername, username, hnd); /* be more verbose */ if (W_ERROR_V(result) == W_ERROR_V(WERR_ACCESS_DENIED)) { d_printf("no access to printer [%s] on [%s] for user [%s] granted\n", - printername, servername2, username); + printername2, servername, username); return False; } if (!W_ERROR_IS_OK(result)) { d_printf("cannot open printer %s on server %s: %s\n", - printername, servername2, dos_errstr(result)); + printername2, servername, dos_errstr(result)); return False; } DEBUG(2,("got printer handle for printer: %s, server: %s\n", - printername, servername2)); + printername2, servername)); return True; } @@ -1088,7 +1093,8 @@ net_spoolss_getprinterdriver(struct cli_state *cli, if (!W_ERROR_IS_OK(result)) { DEBUG(1,("cannot get driver (for architecture: %s): %s\n", env, dos_errstr(result))); - if (W_ERROR_V(result) != W_ERROR_V(WERR_UNKNOWN_PRINTER_DRIVER)) { + if (W_ERROR_V(result) != W_ERROR_V(WERR_UNKNOWN_PRINTER_DRIVER) && + W_ERROR_V(result) != W_ERROR_V(WERR_INVALID_ENVIRONMENT)) { printf("cannot get driver: %s\n", dos_errstr(result)); } return False; @@ -1132,7 +1138,6 @@ get_printer_info(struct cli_state *cli, TALLOC_CTX *mem_ctx, { char *sharename; - fstring servername; POLICY_HND hnd; /* no arguments given, enumerate all printers */ @@ -1150,9 +1155,8 @@ get_printer_info(struct cli_state *cli, TALLOC_CTX *mem_ctx, /* argument given, get a single printer by name */ sharename = strdup(argv[0]); - if (!net_spoolss_open_printer_ex(cli, mem_ctx, sharename, "", - MAXIMUM_ALLOWED_ACCESS, servername, - cli->user_name, &hnd)) + if (!net_spoolss_open_printer_ex(cli, mem_ctx, sharename, + MAXIMUM_ALLOWED_ACCESS, cli->user_name, &hnd)) return False; if (!net_spoolss_getprinter(cli, mem_ctx, &hnd, level, ctr)) { @@ -1284,6 +1288,194 @@ done: } +/** + * Publish print-queues with args-wrapper + * + * @param cli A cli_state connected to the server. + * @param mem_ctx Talloc context, destoyed on compleation of the function. + * @param argc Standard main() style argc + * @param argv Standard main() style argv. Initial components are already + * stripped + * @param action + * + * @return Normal NTSTATUS return. + **/ + +static NTSTATUS rpc_printer_publish_internals_args(struct cli_state *cli, TALLOC_CTX *mem_ctx, + int argc, const char **argv, uint32 action) +{ + NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL; + uint32 i, num_printers; + uint32 level = 7; + pstring printername, sharename; + PRINTER_INFO_CTR ctr, ctr_pub; + POLICY_HND hnd; + BOOL got_hnd = False; + WERROR result; + char *action_str; + + if (!get_printer_info(cli, mem_ctx, 2, argc, argv, &num_printers, &ctr)) + return nt_status; + + for (i = 0; i < num_printers; i++) { + + /* do some initialization */ + rpcstr_pull(printername, ctr.printers_2[i].printername.buffer, + sizeof(printername), -1, STR_TERMINATE); + rpcstr_pull(sharename, ctr.printers_2[i].sharename.buffer, + sizeof(sharename), -1, STR_TERMINATE); + + /* open printer handle */ + if (!net_spoolss_open_printer_ex(cli, mem_ctx, sharename, + PRINTER_ALL_ACCESS, cli->user_name, &hnd)) + goto done; + + got_hnd = True; + + /* check for existing dst printer */ + if (!net_spoolss_getprinter(cli, mem_ctx, &hnd, level, &ctr_pub)) + goto done; + + /* check action and set string */ + switch (action) { + case SPOOL_DS_PUBLISH: + action_str = "published"; + break; + case SPOOL_DS_UPDATE: + action_str = "updated"; + break; + case SPOOL_DS_UNPUBLISH: + action_str = "unpublished"; + break; + default: + printf("unkown action: %d\n", action); + break; + } + + ctr_pub.printers_7->action = action; + + result = cli_spoolss_setprinter(cli, mem_ctx, &hnd, level, &ctr_pub, 0); + if (!W_ERROR_IS_OK(result) && (W_ERROR_V(result) =! W_ERROR_V(WERR_IO_PENDING))) { + printf("cannot set printer-info: %s\n", dos_errstr(result)); + goto done; + } + + printf("successfully %s printer %s in Active Directory\n", action_str, sharename); + } + + nt_status = NT_STATUS_OK; + +done: + if (got_hnd) + cli_spoolss_close_printer(cli, mem_ctx, &hnd); + + return nt_status; +} + +NTSTATUS rpc_printer_publish_publish_internals(const DOM_SID *domain_sid, const char *domain_name, + struct cli_state *cli, TALLOC_CTX *mem_ctx, + int argc, const char **argv) +{ + return rpc_printer_publish_internals_args(cli, mem_ctx, argc, argv, SPOOL_DS_PUBLISH); +} + +NTSTATUS rpc_printer_publish_unpublish_internals(const DOM_SID *domain_sid, const char *domain_name, + struct cli_state *cli, TALLOC_CTX *mem_ctx, + int argc, const char **argv) +{ + return rpc_printer_publish_internals_args(cli, mem_ctx, argc, argv, SPOOL_DS_UNPUBLISH); +} + +NTSTATUS rpc_printer_publish_update_internals(const DOM_SID *domain_sid, const char *domain_name, + struct cli_state *cli, TALLOC_CTX *mem_ctx, + int argc, const char **argv) +{ + return rpc_printer_publish_internals_args(cli, mem_ctx, argc, argv, SPOOL_DS_UPDATE); +} + +/** + * List print-queues w.r.t. thei publishing + * + * All parameters are provided by the run_rpc_command function, except for + * argc, argv which are passed through. + * + * @param domain_sid The domain sid aquired from the remote server + * @param cli A cli_state connected to the server. + * @param mem_ctx Talloc context, destoyed on compleation of the function. + * @param argc Standard main() style argc + * @param argv Standard main() style argv. Initial components are already + * stripped + * + * @return Normal NTSTATUS return. + **/ +NTSTATUS rpc_printer_publish_list_internals(const DOM_SID *domain_sid, const char *domain_name, + struct cli_state *cli, TALLOC_CTX *mem_ctx, + int argc, const char **argv) +{ + NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL; + uint32 i, num_printers; + uint32 level = 7; + pstring printername, sharename; + pstring guid; + PRINTER_INFO_CTR ctr, ctr_pub; + POLICY_HND hnd; + BOOL got_hnd = False; + int state; + + if (!get_printer_info(cli, mem_ctx, 2, argc, argv, &num_printers, &ctr)) + return nt_status; + + for (i = 0; i < num_printers; i++) { + + ZERO_STRUCT(ctr_pub); + + /* do some initialization */ + rpcstr_pull(printername, ctr.printers_2[i].printername.buffer, + sizeof(printername), -1, STR_TERMINATE); + rpcstr_pull(sharename, ctr.printers_2[i].sharename.buffer, + sizeof(sharename), -1, STR_TERMINATE); + + /* open printer handle */ + if (!net_spoolss_open_printer_ex(cli, mem_ctx, sharename, + PRINTER_ALL_ACCESS, cli->user_name, &hnd)) + goto done; + + got_hnd = True; + + /* check for existing dst printer */ + if (!net_spoolss_getprinter(cli, mem_ctx, &hnd, level, &ctr_pub)) + goto done; + + rpcstr_pull(guid, ctr_pub.printers_7->guid.buffer, sizeof(guid), -1, STR_TERMINATE); + + state = ctr_pub.printers_7->action; + switch (state) { + case SPOOL_DS_PUBLISH: + printf("printer [%s] is published", sharename); + if (opt_verbose) + printf(", guid: %s", guid); + printf("\n"); + break; + case SPOOL_DS_UNPUBLISH: + printf("printer [%s] is unpublished\n", sharename); + break; + case SPOOL_DS_UPDATE: + printf("printer [%s] is currently updating\n", sharename); + break; + default: + printf("unkown state: %d\n", state); + break; + } + } + + nt_status = NT_STATUS_OK; + +done: + if (got_hnd) + cli_spoolss_close_printer(cli, mem_ctx, &hnd); + + return nt_status; +} /** * Migrate Printer-ACLs from a source server to the destination server @@ -1311,7 +1503,6 @@ NTSTATUS rpc_printer_migrate_security_internals(const DOM_SID *domain_sid, const uint32 i = 0; uint32 num_printers; uint32 level = 2; - fstring servername = ""; pstring printername = "", sharename = ""; BOOL got_hnd_src = False; BOOL got_hnd_dst = False; @@ -1365,16 +1556,16 @@ NTSTATUS rpc_printer_migrate_security_internals(const DOM_SID *domain_sid, const */ /* open src printer handle */ - if (!net_spoolss_open_printer_ex(cli, mem_ctx, sharename, "", - MAXIMUM_ALLOWED_ACCESS, servername, cli->user_name, &hnd_src)) + if (!net_spoolss_open_printer_ex(cli, mem_ctx, sharename, + MAXIMUM_ALLOWED_ACCESS, cli->user_name, &hnd_src)) goto done; got_hnd_src = True; /* open dst printer handle */ - if (!net_spoolss_open_printer_ex(cli_dst, mem_ctx, sharename, "", - PRINTER_ALL_ACCESS, servername, cli_dst->user_name, &hnd_dst)) + if (!net_spoolss_open_printer_ex(cli_dst, mem_ctx, sharename, + PRINTER_ALL_ACCESS, cli_dst->user_name, &hnd_dst)) goto done; got_hnd_dst = True; @@ -1459,7 +1650,6 @@ NTSTATUS rpc_printer_migrate_forms_internals(const DOM_SID *domain_sid, const ch uint32 i, f; uint32 num_printers; uint32 level = 1; - fstring servername = ""; pstring printername = "", sharename = ""; BOOL got_hnd_src = False; BOOL got_hnd_dst = False; @@ -1510,16 +1700,16 @@ NTSTATUS rpc_printer_migrate_forms_internals(const DOM_SID *domain_sid, const ch /* open src printer handle */ - if (!net_spoolss_open_printer_ex(cli, mem_ctx, sharename, "", - MAXIMUM_ALLOWED_ACCESS, servername, cli->user_name, &hnd_src)) + if (!net_spoolss_open_printer_ex(cli, mem_ctx, sharename, + MAXIMUM_ALLOWED_ACCESS, cli->user_name, &hnd_src)) goto done; got_hnd_src = True; /* open dst printer handle */ - if (!net_spoolss_open_printer_ex(cli_dst, mem_ctx, sharename, "", - PRINTER_ALL_ACCESS, servername, cli->user_name, &hnd_dst)) + if (!net_spoolss_open_printer_ex(cli_dst, mem_ctx, sharename, + PRINTER_ALL_ACCESS, cli->user_name, &hnd_dst)) goto done; got_hnd_dst = True; @@ -1633,7 +1823,6 @@ NTSTATUS rpc_printer_migrate_drivers_internals(const DOM_SID *domain_sid, const uint32 i, p; uint32 num_printers; uint32 level = 3; - fstring servername = ""; pstring printername = "", sharename = ""; BOOL got_hnd_src = False; BOOL got_hnd_dst = False; @@ -1708,8 +1897,8 @@ NTSTATUS rpc_printer_migrate_drivers_internals(const DOM_SID *domain_sid, const printername, sharename); /* open dst printer handle */ - if (!net_spoolss_open_printer_ex(cli_dst, mem_ctx, sharename, "", - PRINTER_ALL_ACCESS, servername, cli->user_name, &hnd_dst)) + if (!net_spoolss_open_printer_ex(cli_dst, mem_ctx, sharename, + PRINTER_ALL_ACCESS, cli->user_name, &hnd_dst)) goto done; got_hnd_dst = True; @@ -1720,8 +1909,8 @@ NTSTATUS rpc_printer_migrate_drivers_internals(const DOM_SID *domain_sid, const /* open src printer handle */ - if (!net_spoolss_open_printer_ex(cli, mem_ctx, sharename, "", - MAXIMUM_ALLOWED_ACCESS, servername, cli->user_name, &hnd_src)) + if (!net_spoolss_open_printer_ex(cli, mem_ctx, sharename, + MAXIMUM_ALLOWED_ACCESS, cli->user_name, &hnd_src)) goto done; got_hnd_src = True; @@ -1848,7 +2037,6 @@ NTSTATUS rpc_printer_migrate_printers_internals(const DOM_SID *domain_sid, const struct cli_state *cli_dst = NULL; POLICY_HND hnd_dst, hnd_src; pstring printername, sharename; - fstring servername; BOOL got_hnd_src = False; BOOL got_hnd_dst = False; BOOL got_dst_spoolss_pipe = False; @@ -1891,8 +2079,8 @@ NTSTATUS rpc_printer_migrate_printers_internals(const DOM_SID *domain_sid, const /* open dst printer handle */ - if (!net_spoolss_open_printer_ex(cli_dst, mem_ctx, sharename, "", - PRINTER_ALL_ACCESS, servername, cli->user_name, &hnd_dst)) { + if (!net_spoolss_open_printer_ex(cli_dst, mem_ctx, sharename, + PRINTER_ALL_ACCESS, cli->user_name, &hnd_dst)) { DEBUG(1,("could not open printer: %s\n", sharename)); } else { @@ -1923,8 +2111,8 @@ NTSTATUS rpc_printer_migrate_printers_internals(const DOM_SID *domain_sid, const we first need a handle for that */ /* open src printer handle */ - if (!net_spoolss_open_printer_ex(cli, mem_ctx, sharename, "", - MAXIMUM_ALLOWED_ACCESS, servername, cli->user_name, &hnd_src)) + if (!net_spoolss_open_printer_ex(cli, mem_ctx, sharename, + MAXIMUM_ALLOWED_ACCESS, cli->user_name, &hnd_src)) goto done; got_hnd_src = True; @@ -2005,7 +2193,6 @@ NTSTATUS rpc_printer_migrate_settings_internals(const DOM_SID *domain_sid, const uint32 i = 0, p = 0, j = 0; uint32 num_printers, val_needed, data_needed; uint32 level = 2; - fstring servername = ""; pstring printername = "", sharename = ""; BOOL got_hnd_src = False; BOOL got_hnd_dst = False; @@ -2064,16 +2251,16 @@ NTSTATUS rpc_printer_migrate_settings_internals(const DOM_SID *domain_sid, const /* open src printer handle */ - if (!net_spoolss_open_printer_ex(cli, mem_ctx, sharename, "", - MAXIMUM_ALLOWED_ACCESS, servername, cli->user_name, &hnd_src)) + if (!net_spoolss_open_printer_ex(cli, mem_ctx, sharename, + MAXIMUM_ALLOWED_ACCESS, cli->user_name, &hnd_src)) goto done; got_hnd_src = True; /* open dst printer handle */ - if (!net_spoolss_open_printer_ex(cli_dst, mem_ctx, sharename, "", - PRINTER_ALL_ACCESS, servername, cli_dst->user_name, &hnd_dst)) + if (!net_spoolss_open_printer_ex(cli_dst, mem_ctx, sharename, + PRINTER_ALL_ACCESS, cli_dst->user_name, &hnd_dst)) goto done; got_hnd_dst = True; diff --git a/source/utils/net_rpc_samsync.c b/source/utils/net_rpc_samsync.c index 882f3a02bc2..2e7c053ac3f 100644 --- a/source/utils/net_rpc_samsync.c +++ b/source/utils/net_rpc_samsync.c @@ -22,7 +22,7 @@ */ #include "includes.h" -#include "../utils/net.h" +#include "utils/net.h" extern DOM_SID global_sid_Builtin; diff --git a/source/utils/net_status.c b/source/utils/net_status.c index 0543f457cfc..21e6bffb2cf 100644 --- a/source/utils/net_status.c +++ b/source/utils/net_status.c @@ -18,7 +18,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "includes.h" -#include "../utils/net.h" +#include "utils/net.h" static int show_session(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf, void *state) diff --git a/source/utils/net_time.c b/source/utils/net_time.c index 45c17838055..691adcea00e 100644 --- a/source/utils/net_time.c +++ b/source/utils/net_time.c @@ -18,7 +18,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "includes.h" -#include "../utils/net.h" +#include "utils/net.h" /* diff --git a/source/utils/nmblookup.c b/source/utils/nmblookup.c index 7285712c0b7..4ed42847867 100644 --- a/source/utils/nmblookup.c +++ b/source/utils/nmblookup.c @@ -118,12 +118,15 @@ static void do_node_status(int fd, const char *name, int type, struct in_addr ip cleanname,status[i].type, node_status_flags(status[i].flags)); } + d_printf("\n\tMAC Address = %02X-%02X-%02X-%02X-%02X-%02X\n", + extra.mac_addr[0], extra.mac_addr[1], + extra.mac_addr[2], extra.mac_addr[3], + extra.mac_addr[4], extra.mac_addr[5]); + d_printf("\n"); SAFE_FREE(status); + } else { + d_printf("No reply from %s\n\n",inet_ntoa(ip)); } - d_printf("\n\tMAC Address = %02X-%02X-%02X-%02X-%02X-%02X\n", - extra.mac_addr[0], extra.mac_addr[1], extra.mac_addr[2], - extra.mac_addr[3], extra.mac_addr[4], extra.mac_addr[5]); - d_printf("\n"); } diff --git a/source/utils/ntlm_auth.c b/source/utils/ntlm_auth.c index 609b480406e..b2c155dfb2a 100644 --- a/source/utils/ntlm_auth.c +++ b/source/utils/ntlm_auth.c @@ -23,7 +23,7 @@ */ #include "includes.h" -#include "../utils/ntlm_auth.h" +#include "utils/ntlm_auth.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_WINBIND @@ -90,7 +90,7 @@ static int request_lm_key; static int request_user_session_key; static const char *require_membership_of; -static const char *require_membership_sid; +static const char *require_membership_of_sid; static char winbind_separator(void) { @@ -214,7 +214,7 @@ static BOOL get_require_membership_sid(void) { return True; } - if (require_membership_sid) { + if (require_membership_of_sid) { return True; } @@ -238,9 +238,9 @@ static BOOL get_require_membership_sid(void) { return False; } - require_membership_sid = strdup(response.data.sid.sid); + require_membership_of_sid = strdup(response.data.sid.sid); - if (require_membership_sid) + if (require_membership_of_sid) return True; return False; @@ -265,8 +265,8 @@ static BOOL check_plaintext_auth(const char *user, const char *pass, fstrcpy(request.data.auth.user, user); fstrcpy(request.data.auth.pass, pass); - if (require_membership_sid) - fstrcpy(request.data.auth.required_membership_sid, require_membership_sid); + if (require_membership_of_sid) + fstrcpy(request.data.auth.require_membership_of_sid, require_membership_of_sid); result = winbindd_request(WINBINDD_PAM_AUTH, &request, &response); @@ -323,27 +323,14 @@ NTSTATUS contact_winbind_auth_crap(const char *username, request.flags = flags; - if (require_membership_sid) - fstrcpy(request.data.auth_crap.required_membership_sid, require_membership_sid); + if (require_membership_of_sid) + fstrcpy(request.data.auth_crap.require_membership_of_sid, require_membership_of_sid); - if (push_utf8_fstring(request.data.auth_crap.user, username) == -1) { - *error_string = smb_xstrdup( - "unable to create utf8 string for username"); - return NT_STATUS_UNSUCCESSFUL; - } - - if (push_utf8_fstring(request.data.auth_crap.domain, domain) == -1) { - *error_string = smb_xstrdup( - "unable to create utf8 string for domain"); - return NT_STATUS_UNSUCCESSFUL; - } + fstrcpy(request.data.auth_crap.user, username); + fstrcpy(request.data.auth_crap.domain, domain); - if (push_utf8_fstring(request.data.auth_crap.workstation, - workstation) == -1) { - *error_string = smb_xstrdup( - "unable to create utf8 string for workstation"); - return NT_STATUS_UNSUCCESSFUL; - } + fstrcpy(request.data.auth_crap.workstation, + workstation); memcpy(request.data.auth_crap.chal, challenge->data, MIN(challenge->length, 8)); @@ -391,7 +378,8 @@ NTSTATUS contact_winbind_auth_crap(const char *username, } if (flags & WBFLAG_PAM_UNIX_NAME) { - if (pull_utf8_allocate(unix_name, (char *)response.extra_data) == -1) { + *unix_name = strdup((char *)response.extra_data); + if (!*unix_name) { free_response(&response); return NT_STATUS_NO_MEMORY; } @@ -478,7 +466,7 @@ static NTSTATUS ntlm_auth_start_ntlmssp_client(NTLMSSP_STATE **client_ntlmssp_st NTSTATUS status; if ( (opt_username == NULL) || (opt_domain == NULL) ) { DEBUG(1, ("Need username and domain for NTLMSSP\n")); - return status; + return NT_STATUS_INVALID_PARAMETER; } status = ntlmssp_client_start(client_ntlmssp_state); @@ -1817,7 +1805,7 @@ enum { case OPT_REQUIRE_MEMBERSHIP: if (StrnCaseCmp("S-", require_membership_of, 2) == 0) { - require_membership_sid = require_membership_of; + require_membership_of_sid = require_membership_of; } break; } diff --git a/source/utils/ntlm_auth.h b/source/utils/ntlm_auth.h index a96067fbbb8..5e49b862a20 100644 --- a/source/utils/ntlm_auth.h +++ b/source/utils/ntlm_auth.h @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include "../utils/ntlm_auth_proto.h" +#include "utils/ntlm_auth_proto.h" /* Some of the popt variables are needed in the diagnostics code */ extern const char *opt_username; diff --git a/source/utils/ntlm_auth_diagnostics.c b/source/utils/ntlm_auth_diagnostics.c index 3489dbca7c8..7fae0ede978 100644 --- a/source/utils/ntlm_auth_diagnostics.c +++ b/source/utils/ntlm_auth_diagnostics.c @@ -23,7 +23,7 @@ */ #include "includes.h" -#include "../utils/ntlm_auth.h" +#include "utils/ntlm_auth.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_WINBIND diff --git a/source/utils/testparm.c b/source/utils/testparm.c index 9db6d538d24..d4dc22ec915 100644 --- a/source/utils/testparm.c +++ b/source/utils/testparm.c @@ -132,7 +132,8 @@ parameter.\n" ); cannot be executed (error was %s).\n", truncated_prog, strerror(errno) ); ret = 1; } - } + + } #ifdef WITH_PAM } @@ -142,6 +143,11 @@ cannot be executed (error was %s).\n", truncated_prog, strerror(errno) ); fprintf(stderr, "ERROR: the 'unix password sync' parameter is set and there is no valid 'passwd chat' \ parameter.\n"); ret = 1; + } else + /* check if there's a %u parameter present */ + if(strstr_m(lp_passwd_chat(), "%u") == NULL) { + fprintf(stderr, "ERROR: the 'passwd program' (%s) requires a '%%u' parameter.\n", lp_passwd_program()); + ret = 1; } /* @@ -365,3 +371,4 @@ via the %%o substitution. With encrypted passwords this is not possible.\n", lp_ } return(ret); } + diff --git a/source/web/cgi.c b/source/web/cgi.c index b1aa8ae754c..cf309c364e2 100644 --- a/source/web/cgi.c +++ b/source/web/cgi.c @@ -19,7 +19,7 @@ #include "includes.h" -#include "../web/swat_proto.h" +#include "web/swat_proto.h" #define MAX_VARIABLES 10000 @@ -196,18 +196,18 @@ void cgi_load_variables(void) printf("<!== End dump in cgi_load_variables() ==>\n"); #endif - /* variables from the client are in display charset - convert them - to our internal charset before use */ + /* variables from the client are in UTF-8 - convert them + to our internal unix charset before use */ for (i=0;i<num_variables;i++) { pstring dest; - convert_string(CH_DISPLAY, CH_UNIX, + convert_string(CH_UTF8, CH_UNIX, variables[i].name, -1, dest, sizeof(dest), True); free(variables[i].name); variables[i].name = strdup(dest); - convert_string(CH_DISPLAY, CH_UNIX, + convert_string(CH_UTF8, CH_UNIX, variables[i].value, -1, dest, sizeof(dest), True); free(variables[i].value); @@ -334,11 +334,11 @@ static BOOL cgi_handle_authorization(char *line) } *p = 0; - convert_string(CH_DISPLAY, CH_UNIX, + convert_string(CH_UTF8, CH_UNIX, line, -1, user, sizeof(user), True); - convert_string(CH_DISPLAY, CH_UNIX, + convert_string(CH_UTF8, CH_UNIX, p+1, -1, user_pass, sizeof(user_pass), True); diff --git a/source/web/diagnose.c b/source/web/diagnose.c index 46432c41f85..a4907860685 100644 --- a/source/web/diagnose.c +++ b/source/web/diagnose.c @@ -19,7 +19,7 @@ */ #include "includes.h" -#include "../web/swat_proto.h" +#include "web/swat_proto.h" #ifdef WITH_WINBIND diff --git a/source/web/neg_lang.c b/source/web/neg_lang.c index da974f78a4a..aa285745d6c 100644 --- a/source/web/neg_lang.c +++ b/source/web/neg_lang.c @@ -20,7 +20,7 @@ */ #include "includes.h" -#include "../web/swat_proto.h" +#include "web/swat_proto.h" /* during a file download we first check to see if there is a language diff --git a/source/web/startstop.c b/source/web/startstop.c index 93e8650c2bc..9ffda5bb941 100644 --- a/source/web/startstop.c +++ b/source/web/startstop.c @@ -19,7 +19,7 @@ */ #include "includes.h" -#include "../web/swat_proto.h" +#include "web/swat_proto.h" #include "dynconfig.h" diff --git a/source/web/statuspage.c b/source/web/statuspage.c index 3d70796830d..953222c2fc1 100644 --- a/source/web/statuspage.c +++ b/source/web/statuspage.c @@ -19,7 +19,7 @@ */ #include "includes.h" -#include "../web/swat_proto.h" +#include "web/swat_proto.h" #define PIDMAP struct PidMap @@ -107,42 +107,46 @@ static char *tstring(time_t t) static void print_share_mode(share_mode_entry *e, char *fname) { - d_printf("<tr><td>%s</td>",_(mapPid2Machine(e->pid))); - d_printf("<td>"); + char *utf8_fname; + + printf("<tr><td>%s</td>",_(mapPid2Machine(e->pid))); + printf("<td>"); switch ((e->share_mode>>4)&0xF) { - case DENY_NONE: d_printf("DENY_NONE"); break; - case DENY_ALL: d_printf("DENY_ALL "); break; - case DENY_DOS: d_printf("DENY_DOS "); break; - case DENY_READ: d_printf("DENY_READ "); break; - case DENY_WRITE:d_printf("DENY_WRITE "); break; + case DENY_NONE: printf("DENY_NONE"); break; + case DENY_ALL: printf("DENY_ALL "); break; + case DENY_DOS: printf("DENY_DOS "); break; + case DENY_READ: printf("DENY_READ "); break; + case DENY_WRITE:printf("DENY_WRITE "); break; } - d_printf("</td>"); + printf("</td>"); - d_printf("<td>"); + printf("<td>"); switch (e->share_mode&0xF) { - case 0: d_printf("%s", _("RDONLY ")); break; - case 1: d_printf("%s", _("WRONLY ")); break; - case 2: d_printf("%s", _("RDWR ")); break; + case 0: printf("%s", _("RDONLY ")); break; + case 1: printf("%s", _("WRONLY ")); break; + case 2: printf("%s", _("RDWR ")); break; } - d_printf("</td>"); + printf("</td>"); - d_printf("<td>"); + printf("<td>"); if((e->op_type & (EXCLUSIVE_OPLOCK|BATCH_OPLOCK)) == (EXCLUSIVE_OPLOCK|BATCH_OPLOCK)) - d_printf("EXCLUSIVE+BATCH "); + printf("EXCLUSIVE+BATCH "); else if (e->op_type & EXCLUSIVE_OPLOCK) - d_printf("EXCLUSIVE "); + printf("EXCLUSIVE "); else if (e->op_type & BATCH_OPLOCK) - d_printf("BATCH "); + printf("BATCH "); else if (e->op_type & LEVEL_II_OPLOCK) - d_printf("LEVEL_II "); + printf("LEVEL_II "); else - d_printf("NONE "); - d_printf("</td>"); + printf("NONE "); + printf("</td>"); - d_printf("<td>%s</td><td>%s</td></tr>\n", - fname,tstring(e->time.tv_sec)); + push_utf8_allocate(&utf8_fname, fname); + printf("<td>%s</td><td>%s</td></tr>\n", + utf8_fname,tstring(e->time.tv_sec)); + SAFE_FREE(utf8_fname); } @@ -182,15 +186,15 @@ static int traverse_fn2(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf, void* st addPid2Machine (crec.pid, crec.machine); - d_printf("<tr><td>%d</td><td>%s</td><td>%s</td><td>%s</td>\n", + printf("<tr><td>%d</td><td>%s</td><td>%s</td><td>%s</td>\n", (int)crec.pid, crec.machine,crec.addr, tstring(crec.start)); if (geteuid() == 0) { - d_printf("<td><input type=submit value=\"X\" name=\"kill_%d\"></td>\n", + printf("<td><input type=submit value=\"X\" name=\"kill_%d\"></td>\n", (int)crec.pid); } - d_printf("</tr>\n"); + printf("</tr>\n"); return 0; } @@ -208,7 +212,7 @@ static int traverse_fn3(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf, void* st if (crec.cnum == -1 || !process_exists(crec.pid)) return 0; - d_printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%d</td><td>%s</td><td>%s</td></tr>\n", + printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%d</td><td>%s</td><td>%s</td></tr>\n", crec.name,uidtoname(crec.uid), gidtoname(crec.gid),(int)crec.pid, crec.machine, @@ -306,22 +310,22 @@ void status_page(void) initPid2Machine (); - d_printf("<H2>%s</H2>\n", _("Server Status")); + printf("<H2>%s</H2>\n", _("Server Status")); - d_printf("<FORM method=post>\n"); + printf("<FORM method=post>\n"); if (!autorefresh) { - d_printf("<input type=submit value=\"%s\" name=\"autorefresh\">\n", _("Auto Refresh")); - d_printf("<br>%s", _("Refresh Interval: ")); - d_printf("<input type=text size=2 name=\"refresh_interval\" value=\"%d\">\n", + printf("<input type=submit value=\"%s\" name=\"autorefresh\">\n", _("Auto Refresh")); + printf("<br>%s", _("Refresh Interval: ")); + printf("<input type=text size=2 name=\"refresh_interval\" value=\"%d\">\n", refresh_interval); } else { - d_printf("<input type=submit value=\"%s\" name=\"norefresh\">\n", _("Stop Refreshing")); - d_printf("<br>%s%d\n", _("Refresh Interval: "), refresh_interval); - d_printf("<input type=hidden name=\"refresh\" value=\"1\">\n"); + printf("<input type=submit value=\"%s\" name=\"norefresh\">\n", _("Stop Refreshing")); + printf("<br>%s%d\n", _("Refresh Interval: "), refresh_interval); + printf("<input type=hidden name=\"refresh\" value=\"1\">\n"); } - d_printf("<p>\n"); + printf("<p>\n"); if (!tdb) { /* open failure either means no connections have been @@ -329,113 +333,113 @@ void status_page(void) } - d_printf("<table>\n"); + printf("<table>\n"); - d_printf("<tr><td>%s</td><td>%s</td></tr>", _("version:"), SAMBA_VERSION_STRING); + printf("<tr><td>%s</td><td>%s</td></tr>", _("version:"), SAMBA_VERSION_STRING); fflush(stdout); - d_printf("<tr><td>%s</td><td>%s</td>\n", _("smbd:"), smbd_running()?_("running"):_("not running")); + printf("<tr><td>%s</td><td>%s</td>\n", _("smbd:"), smbd_running()?_("running"):_("not running")); if (geteuid() == 0) { if (smbd_running()) { nr_running++; - d_printf("<td><input type=submit name=\"smbd_stop\" value=\"%s\"></td>\n", _("Stop smbd")); + printf("<td><input type=submit name=\"smbd_stop\" value=\"%s\"></td>\n", _("Stop smbd")); } else { - d_printf("<td><input type=submit name=\"smbd_start\" value=\"%s\"></td>\n", _("Start smbd")); + printf("<td><input type=submit name=\"smbd_start\" value=\"%s\"></td>\n", _("Start smbd")); } - d_printf("<td><input type=submit name=\"smbd_restart\" value=\"%s\"></td>\n", _("Restart smbd")); + printf("<td><input type=submit name=\"smbd_restart\" value=\"%s\"></td>\n", _("Restart smbd")); } - d_printf("</tr>\n"); + printf("</tr>\n"); fflush(stdout); - d_printf("<tr><td>%s</td><td>%s</td>\n", _("nmbd:"), nmbd_running()?_("running"):_("not running")); + printf("<tr><td>%s</td><td>%s</td>\n", _("nmbd:"), nmbd_running()?_("running"):_("not running")); if (geteuid() == 0) { if (nmbd_running()) { nr_running++; - d_printf("<td><input type=submit name=\"nmbd_stop\" value=\"%s\"></td>\n", _("Stop nmbd")); + printf("<td><input type=submit name=\"nmbd_stop\" value=\"%s\"></td>\n", _("Stop nmbd")); } else { - d_printf("<td><input type=submit name=\"nmbd_start\" value=\"%s\"></td>\n", _("Start nmbd")); + printf("<td><input type=submit name=\"nmbd_start\" value=\"%s\"></td>\n", _("Start nmbd")); } - d_printf("<td><input type=submit name=\"nmbd_restart\" value=\"%s\"></td>\n", _("Restart nmbd")); + printf("<td><input type=submit name=\"nmbd_restart\" value=\"%s\"></td>\n", _("Restart nmbd")); } - d_printf("</tr>\n"); + printf("</tr>\n"); #ifdef WITH_WINBIND fflush(stdout); - d_printf("<tr><td>%s</td><td>%s</td>\n", _("winbindd:"), winbindd_running()?_("running"):_("not running")); + printf("<tr><td>%s</td><td>%s</td>\n", _("winbindd:"), winbindd_running()?_("running"):_("not running")); if (geteuid() == 0) { if (winbindd_running()) { nr_running++; - d_printf("<td><input type=submit name=\"winbindd_stop\" value=\"%s\"></td>\n", _("Stop winbindd")); + printf("<td><input type=submit name=\"winbindd_stop\" value=\"%s\"></td>\n", _("Stop winbindd")); } else { - d_printf("<td><input type=submit name=\"winbindd_start\" value=\"%s\"></td>\n", _("Start winbindd")); + printf("<td><input type=submit name=\"winbindd_start\" value=\"%s\"></td>\n", _("Start winbindd")); } - d_printf("<td><input type=submit name=\"winbindd_restart\" value=\"%s\"></td>\n", _("Restart winbindd")); + printf("<td><input type=submit name=\"winbindd_restart\" value=\"%s\"></td>\n", _("Restart winbindd")); } - d_printf("</tr>\n"); + printf("</tr>\n"); #endif if (geteuid() == 0) { - d_printf("<tr><td></td><td></td>\n"); + printf("<tr><td></td><td></td>\n"); if (nr_running >= 1) { /* stop, restart all */ - d_printf("<td><input type=submit name=\"all_stop\" value=\"%s\"></td>\n", _("Stop All")); - d_printf("<td><input type=submit name=\"all_restart\" value=\"%s\"></td>\n", _("Restart All")); + printf("<td><input type=submit name=\"all_stop\" value=\"%s\"></td>\n", _("Stop All")); + printf("<td><input type=submit name=\"all_restart\" value=\"%s\"></td>\n", _("Restart All")); } else if (nr_running == 0) { /* start all */ - d_printf("<td><input type=submit name=\"all_start\" value=\"%s\"></td>\n", _("Start All")); + printf("<td><input type=submit name=\"all_start\" value=\"%s\"></td>\n", _("Start All")); } - d_printf("</tr>\n"); + printf("</tr>\n"); } - d_printf("</table>\n"); + printf("</table>\n"); fflush(stdout); - d_printf("<p><h3>%s</h3>\n", _("Active Connections")); - d_printf("<table border=1>\n"); - d_printf("<tr><th>%s</th><th>%s</th><th>%s</th><th>%s</th>\n", _("PID"), _("Client"), _("IP address"), _("Date")); + printf("<p><h3>%s</h3>\n", _("Active Connections")); + printf("<table border=1>\n"); + printf("<tr><th>%s</th><th>%s</th><th>%s</th><th>%s</th>\n", _("PID"), _("Client"), _("IP address"), _("Date")); if (geteuid() == 0) { - d_printf("<th>%s</th>\n", _("Kill")); + printf("<th>%s</th>\n", _("Kill")); } - d_printf("</tr>\n"); + printf("</tr>\n"); if (tdb) tdb_traverse(tdb, traverse_fn2, NULL); - d_printf("</table><p>\n"); + printf("</table><p>\n"); - d_printf("<p><h3>%s</h3>\n", _("Active Shares")); - d_printf("<table border=1>\n"); - d_printf("<tr><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th></tr>\n\n", + printf("<p><h3>%s</h3>\n", _("Active Shares")); + printf("<table border=1>\n"); + printf("<tr><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th></tr>\n\n", _("Share"), _("User"), _("Group"), _("PID"), _("Client"), _("Date")); if (tdb) tdb_traverse(tdb, traverse_fn3, NULL); - d_printf("</table><p>\n"); + printf("</table><p>\n"); - d_printf("<h3>%s</h3>\n", _("Open Files")); - d_printf("<table border=1>\n"); - d_printf("<tr><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th></tr>\n", _("PID"), _("Sharing"), _("R/W"), _("Oplock"), _("File"), _("Date")); + printf("<h3>%s</h3>\n", _("Open Files")); + printf("<table border=1>\n"); + printf("<tr><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th></tr>\n", _("PID"), _("Sharing"), _("R/W"), _("Oplock"), _("File"), _("Date")); locking_init(1); share_mode_forall(print_share_mode); locking_end(); - d_printf("</table>\n"); + printf("</table>\n"); if (tdb) tdb_close(tdb); - d_printf("<br><input type=submit name=\"show_client_in_col_1\" value=\"%s\">\n", _("Show Client in col 1")); - d_printf("<input type=submit name=\"show_pid_in_col_1\" value=\"%s\">\n", _("Show PID in col 1")); + printf("<br><input type=submit name=\"show_client_in_col_1\" value=\"%s\">\n", _("Show Client in col 1")); + printf("<input type=submit name=\"show_pid_in_col_1\" value=\"%s\">\n", _("Show PID in col 1")); - d_printf("</FORM>\n"); + printf("</FORM>\n"); if (autorefresh) { /* this little JavaScript allows for automatic refresh of the page. There are other methods but this seems to be the best alternative */ - d_printf("<script language=\"JavaScript\">\n"); - d_printf("<!--\nsetTimeout('window.location.replace(\"%s/status?refresh_interval=%d&refresh=1\")', %d)\n", + printf("<script language=\"JavaScript\">\n"); + printf("<!--\nsetTimeout('window.location.replace(\"%s/status?refresh_interval=%d&refresh=1\")', %d)\n", cgi_baseurl(), refresh_interval, refresh_interval*1000); - d_printf("//-->\n</script>\n"); + printf("//-->\n</script>\n"); } } diff --git a/source/web/swat.c b/source/web/swat.c index ed53d0d7128..48537d1d049 100644 --- a/source/web/swat.c +++ b/source/web/swat.c @@ -29,7 +29,7 @@ **/ #include "includes.h" -#include "../web/swat_proto.h" +#include "web/swat_proto.h" static BOOL demo_mode = False; static BOOL have_write_access = False; @@ -115,8 +115,8 @@ static int include_html(const char *fname) fd = web_open(fname, O_RDONLY, 0); if (fd == -1) { - d_printf(_("ERROR: Can't open %s"), fname); - d_printf("\n"); + printf(_("ERROR: Can't open %s"), fname); + printf("\n"); return 0; } @@ -134,13 +134,13 @@ static int include_html(const char *fname) static void print_header(void) { if (!cgi_waspost()) { - d_printf("Expires: 0\r\n"); + printf("Expires: 0\r\n"); } - d_printf("Content-type: text/html\r\n\r\n"); + printf("Content-type: text/html\r\n\r\n"); if (!include_html("include/header.html")) { - d_printf("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\">\n"); - d_printf("<HTML>\n<HEAD>\n<TITLE>Samba Web Administration Tool</TITLE>\n</HEAD>\n<BODY background=\"/swat/images/background.jpg\">\n\n"); + printf("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\">\n"); + printf("<HTML>\n<HEAD>\n<TITLE>Samba Web Administration Tool</TITLE>\n</HEAD>\n<BODY background=\"/swat/images/background.jpg\">\n\n"); } } @@ -182,7 +182,7 @@ static const char* get_parm_translated( static void print_footer(void) { if (!include_html("include/footer.html")) { - d_printf("\n</BODY>\n</HTML>\n"); + printf("\n</BODY>\n</HTML>\n"); } } @@ -198,106 +198,106 @@ static void show_parameter(int snum, struct parm_struct *parm) ptr = lp_local_ptr(snum, ptr); } - d_printf("<tr><td>%s</td><td>", get_parm_translated(stripspaceupper(parm->label), _("Help"), parm->label)); + printf("<tr><td>%s</td><td>", get_parm_translated(stripspaceupper(parm->label), _("Help"), parm->label)); switch (parm->type) { case P_CHAR: - d_printf("<input type=text size=2 name=\"parm_%s\" value=\"%c\">", + printf("<input type=text size=2 name=\"parm_%s\" value=\"%c\">", make_parm_name(parm->label), *(char *)ptr); - d_printf("<input type=button value=\"%s\" onClick=\"swatform.parm_%s.value=\'%c\'\">", + printf("<input type=button value=\"%s\" onClick=\"swatform.parm_%s.value=\'%c\'\">", _("Set Default"), make_parm_name(parm->label),(char)(parm->def.cvalue)); break; case P_LIST: - d_printf("<input type=text size=40 name=\"parm_%s\" value=\"", + printf("<input type=text size=40 name=\"parm_%s\" value=\"", make_parm_name(parm->label)); if ((char ***)ptr && *(char ***)ptr && **(char ***)ptr) { char **list = *(char ***)ptr; for (;*list;list++) { /* enclose in quotes if the string contains a space */ if ( strchr_m(*list, ' ') ) - d_printf("\'%s\'%s", *list, ((*(list+1))?", ":"")); + printf("\'%s\'%s", *list, ((*(list+1))?", ":"")); else - d_printf("%s%s", *list, ((*(list+1))?", ":"")); + printf("%s%s", *list, ((*(list+1))?", ":"")); } } - d_printf("\">"); - d_printf("<input type=button value=\"%s\" onClick=\"swatform.parm_%s.value=\'", + printf("\">"); + printf("<input type=button value=\"%s\" onClick=\"swatform.parm_%s.value=\'", _("Set Default"), make_parm_name(parm->label)); if (parm->def.lvalue) { char **list = (char **)(parm->def.lvalue); for (; *list; list++) { /* enclose in quotes if the string contains a space */ if ( strchr_m(*list, ' ') ) - d_printf("\'%s\'%s", *list, ((*(list+1))?", ":"")); + printf("\'%s\'%s", *list, ((*(list+1))?", ":"")); else - d_printf("%s%s", *list, ((*(list+1))?", ":"")); + printf("%s%s", *list, ((*(list+1))?", ":"")); } } - d_printf("\'\">"); + printf("\'\">"); break; case P_STRING: case P_USTRING: - d_printf("<input type=text size=40 name=\"parm_%s\" value=\"%s\">", + printf("<input type=text size=40 name=\"parm_%s\" value=\"%s\">", make_parm_name(parm->label), *(char **)ptr); - d_printf("<input type=button value=\"%s\" onClick=\"swatform.parm_%s.value=\'%s\'\">", + printf("<input type=button value=\"%s\" onClick=\"swatform.parm_%s.value=\'%s\'\">", _("Set Default"), make_parm_name(parm->label),fix_backslash((char *)(parm->def.svalue))); break; case P_GSTRING: case P_UGSTRING: - d_printf("<input type=text size=40 name=\"parm_%s\" value=\"%s\">", + printf("<input type=text size=40 name=\"parm_%s\" value=\"%s\">", make_parm_name(parm->label), (char *)ptr); - d_printf("<input type=button value=\"%s\" onClick=\"swatform.parm_%s.value=\'%s\'\">", + printf("<input type=button value=\"%s\" onClick=\"swatform.parm_%s.value=\'%s\'\">", _("Set Default"), make_parm_name(parm->label),fix_backslash((char *)(parm->def.svalue))); break; case P_BOOL: - d_printf("<select name=\"parm_%s\">",make_parm_name(parm->label)); - d_printf("<option %s>Yes", (*(BOOL *)ptr)?"selected":""); - d_printf("<option %s>No", (*(BOOL *)ptr)?"":"selected"); - d_printf("</select>"); - d_printf("<input type=button value=\"%s\" onClick=\"swatform.parm_%s.selectedIndex=\'%d\'\">", + printf("<select name=\"parm_%s\">",make_parm_name(parm->label)); + printf("<option %s>Yes", (*(BOOL *)ptr)?"selected":""); + printf("<option %s>No", (*(BOOL *)ptr)?"":"selected"); + printf("</select>"); + printf("<input type=button value=\"%s\" onClick=\"swatform.parm_%s.selectedIndex=\'%d\'\">", _("Set Default"), make_parm_name(parm->label),(BOOL)(parm->def.bvalue)?0:1); break; case P_BOOLREV: - d_printf("<select name=\"parm_%s\">",make_parm_name(parm->label)); - d_printf("<option %s>Yes", (*(BOOL *)ptr)?"":"selected"); - d_printf("<option %s>No", (*(BOOL *)ptr)?"selected":""); - d_printf("</select>"); - d_printf("<input type=button value=\"%s\" onClick=\"swatform.parm_%s.selectedIndex=\'%d\'\">", + printf("<select name=\"parm_%s\">",make_parm_name(parm->label)); + printf("<option %s>Yes", (*(BOOL *)ptr)?"":"selected"); + printf("<option %s>No", (*(BOOL *)ptr)?"selected":""); + printf("</select>"); + printf("<input type=button value=\"%s\" onClick=\"swatform.parm_%s.selectedIndex=\'%d\'\">", _("Set Default"), make_parm_name(parm->label),(BOOL)(parm->def.bvalue)?1:0); break; case P_INTEGER: - d_printf("<input type=text size=8 name=\"parm_%s\" value=\"%d\">", make_parm_name(parm->label), *(int *)ptr); - d_printf("<input type=button value=\"%s\" onClick=\"swatform.parm_%s.value=\'%d\'\">", + printf("<input type=text size=8 name=\"parm_%s\" value=\"%d\">", make_parm_name(parm->label), *(int *)ptr); + printf("<input type=button value=\"%s\" onClick=\"swatform.parm_%s.value=\'%d\'\">", _("Set Default"), make_parm_name(parm->label),(int)(parm->def.ivalue)); break; case P_OCTAL: - d_printf("<input type=text size=8 name=\"parm_%s\" value=%s>", make_parm_name(parm->label), octal_string(*(int *)ptr)); - d_printf("<input type=button value=\"%s\" onClick=\"swatform.parm_%s.value=\'%s\'\">", + printf("<input type=text size=8 name=\"parm_%s\" value=%s>", make_parm_name(parm->label), octal_string(*(int *)ptr)); + printf("<input type=button value=\"%s\" onClick=\"swatform.parm_%s.value=\'%s\'\">", _("Set Default"), make_parm_name(parm->label), octal_string((int)(parm->def.ivalue))); break; case P_ENUM: - d_printf("<select name=\"parm_%s\">",make_parm_name(parm->label)); + printf("<select name=\"parm_%s\">",make_parm_name(parm->label)); for (i=0;parm->enum_list[i].name;i++) { if (i == 0 || parm->enum_list[i].value != parm->enum_list[i-1].value) { - d_printf("<option %s>%s",(*(int *)ptr)==parm->enum_list[i].value?"selected":"",parm->enum_list[i].name); + printf("<option %s>%s",(*(int *)ptr)==parm->enum_list[i].value?"selected":"",parm->enum_list[i].name); } } - d_printf("</select>"); - d_printf("<input type=button value=\"%s\" onClick=\"swatform.parm_%s.selectedIndex=\'%d\'\">", + printf("</select>"); + printf("<input type=button value=\"%s\" onClick=\"swatform.parm_%s.selectedIndex=\'%d\'\">", _("Set Default"), make_parm_name(parm->label),enum_index((int)(parm->def.ivalue),parm->enum_list)); break; case P_SEP: break; } - d_printf("</td></tr>\n"); + printf("</td></tr>\n"); } /**************************************************************************** @@ -376,7 +376,7 @@ static void show_parameters(int snum, int allparameters, unsigned int parm_filte if ((parm_filter & FLAG_ADVANCED) && !(parm->flags & FLAG_ADVANCED)) continue; if (heading && heading != last_heading) { - d_printf("<tr><td></td></tr><tr><td><b><u>%s</u></b></td></tr>\n", _(heading)); + printf("<tr><td></td></tr><tr><td><b><u>%s</u></b></td></tr>\n", _(heading)); last_heading = heading; } show_parameter(snum, parm); @@ -414,8 +414,8 @@ static int save_reload(int snum) f = sys_fopen(dyn_CONFIGFILE,"w"); if (!f) { - d_printf(_("failed to open %s for writing"), dyn_CONFIGFILE); - d_printf("\n"); + printf(_("failed to open %s for writing"), dyn_CONFIGFILE); + printf("\n"); return 0; } @@ -437,8 +437,8 @@ static int save_reload(int snum) lp_killunused(NULL); if (!load_config(False)) { - d_printf(_("Can't reload %s"), dyn_CONFIGFILE); - d_printf("\n"); + printf(_("Can't reload %s"), dyn_CONFIGFILE); + printf("\n"); return 0; } iNumNonAutoPrintServices = lp_numservices(); @@ -494,7 +494,7 @@ static void commit_parameters(int snum) ****************************************************************************/ static void image_link(const char *name, const char *hlink, const char *src) { - d_printf("<A HREF=\"%s/%s\"><img border=\"0\" src=\"/swat/%s\" alt=\"%s\"></A>\n", + printf("<A HREF=\"%s/%s\"><img border=\"0\" src=\"/swat/%s\" alt=\"%s\"></A>\n", cgi_baseurl(), hlink, src, name); } @@ -507,8 +507,8 @@ static void show_main_buttons(void) char *p; if ((p = cgi_user_name()) && strcmp(p, "root")) { - d_printf(_("Logged in as <b>%s</b>"), p); - d_printf("<p>\n"); + printf(_("Logged in as <b>%s</b>"), p); + printf("<p>\n"); } image_link(_("Home"), "", "images/home.gif"); @@ -524,7 +524,7 @@ static void show_main_buttons(void) } image_link(_("Password Management"), "passwd", "images/passwd.gif"); - d_printf("<HR>\n"); + printf("<HR>\n"); } /**************************************************************************** @@ -532,13 +532,13 @@ static void show_main_buttons(void) ****************************************************************************/ static void ViewModeBoxes(int mode) { - d_printf("<p>%s: \n", _("Current View Is")); - d_printf("<input type=radio name=\"ViewMode\" value=0 %s>%s\n", ((mode == 0) ? "checked" : ""), _("Basic")); - d_printf("<input type=radio name=\"ViewMode\" value=1 %s>%s\n", ((mode == 1) ? "checked" : ""), _("Advanced")); - d_printf("<br>%s: \n", _("Change View To")); - d_printf("<input type=submit name=\"BasicMode\" value=\"%s\">\n", _("Basic")); - d_printf("<input type=submit name=\"AdvMode\" value=\"%s\">\n", _("Advanced")); - d_printf("</p><br>\n"); + printf("<p>%s: \n", _("Current View Is")); + printf("<input type=radio name=\"ViewMode\" value=0 %s>%s\n", ((mode == 0) ? "checked" : ""), _("Basic")); + printf("<input type=radio name=\"ViewMode\" value=1 %s>%s\n", ((mode == 1) ? "checked" : ""), _("Advanced")); + printf("<br>%s: \n", _("Change View To")); + printf("<input type=submit name=\"BasicMode\" value=\"%s\">\n", _("Basic")); + printf("<input type=submit name=\"AdvMode\" value=\"%s\">\n", _("Advanced")); + printf("</p><br>\n"); } /**************************************************************************** @@ -560,19 +560,19 @@ static void viewconfig_page(void) full_view = 1; } - d_printf("<H2>%s</H2>\n", _("Current Config")); - d_printf("<form method=post>\n"); + printf("<H2>%s</H2>\n", _("Current Config")); + printf("<form method=post>\n"); if (full_view) { - d_printf("<input type=submit name=\"normal_view\" value=\"%s\">\n", _("Normal View")); + printf("<input type=submit name=\"normal_view\" value=\"%s\">\n", _("Normal View")); } else { - d_printf("<input type=submit name=\"full_view\" value=\"%s\">\n", _("Full View")); + printf("<input type=submit name=\"full_view\" value=\"%s\">\n", _("Full View")); } - d_printf("<p><pre>"); + printf("<p><pre>"); write_config(stdout, full_view); - d_printf("</pre>"); - d_printf("</form>\n"); + printf("</pre>"); + printf("</form>\n"); } /**************************************************************************** @@ -585,26 +585,26 @@ static void wizard_params_page(void) /* Here we first set and commit all the parameters that were selected in the previous screen. */ - d_printf("<H2>%s</H2>\n", _("Wizard Parameter Edit Page")); + printf("<H2>%s</H2>\n", _("Wizard Parameter Edit Page")); if (cgi_variable("Commit")) { commit_parameters(GLOBAL_SECTION_SNUM); save_reload(0); } - d_printf("<form name=\"swatform\" method=post action=wizard_params>\n"); + printf("<form name=\"swatform\" method=post action=wizard_params>\n"); if (have_write_access) { - d_printf("<input type=submit name=\"Commit\" value=\"Commit Changes\">\n"); + printf("<input type=submit name=\"Commit\" value=\"Commit Changes\">\n"); } - d_printf("<input type=reset name=\"Reset Values\" value=\"Reset\">\n"); - d_printf("<p>\n"); + printf("<input type=reset name=\"Reset Values\" value=\"Reset\">\n"); + printf("<p>\n"); - d_printf("<table>\n"); + printf("<table>\n"); show_parameters(GLOBAL_SECTION_SNUM, 1, parm_filter, 0); - d_printf("</table>\n"); - d_printf("</form>\n"); + printf("</table>\n"); + printf("</form>\n"); } /**************************************************************************** @@ -614,7 +614,7 @@ static void rewritecfg_file(void) { commit_parameters(GLOBAL_SECTION_SNUM); save_reload(0); - d_printf("<H2>%s</H2>\n", _("Note: smb.conf file has been read and rewritten")); + printf("<H2>%s</H2>\n", _("Note: smb.conf file has been read and rewritten")); } /**************************************************************************** @@ -722,66 +722,66 @@ static void wizard_page(void) role = lp_server_role(); /* Here we go ... */ - d_printf("<H2>%s</H2>\n", _("Samba Configuration Wizard")); - d_printf("<form method=post action=wizard>\n"); + printf("<H2>%s</H2>\n", _("Samba Configuration Wizard")); + printf("<form method=post action=wizard>\n"); if (have_write_access) { - d_printf("%s\n", _("The \"Rewrite smb.conf file\" button will clear the smb.conf file of all default values and of comments.")); - d_printf("%s", _("The same will happen if you press the commit button.")); - d_printf("<br><br>\n"); - d_printf("<center>"); - d_printf("<input type=submit name=\"Rewrite\" value=\"%s\"> ",_("Rewrite smb.conf file")); - d_printf("<input type=submit name=\"Commit\" value=\"%s\"> ",_("Commit")); - d_printf("<input type=submit name=\"GetWizardParams\" value=\"%s\">", _("Edit Parameter Values")); - d_printf("</center>\n"); - } - - d_printf("<hr>"); - d_printf("<center><table border=0>"); - d_printf("<tr><td><b>%s: </b></td>\n", _("Server Type")); - d_printf("<td><input type=radio name=\"ServerType\" value=\"0\" %s> %s </td>", ((role == ROLE_STANDALONE) ? "checked" : ""), _("Stand Alone")); - d_printf("<td><input type=radio name=\"ServerType\" value=\"1\" %s> %s </td>", ((role == ROLE_DOMAIN_MEMBER) ? "checked" : ""), _("Domain Member")); - d_printf("<td><input type=radio name=\"ServerType\" value=\"2\" %s> %s </td>", ((role == ROLE_DOMAIN_PDC) ? "checked" : ""), _("Domain Controller")); - d_printf("</tr>\n"); + printf("%s\n", _("The \"Rewrite smb.conf file\" button will clear the smb.conf file of all default values and of comments.")); + printf("%s", _("The same will happen if you press the commit button.")); + printf("<br><br>\n"); + printf("<center>"); + printf("<input type=submit name=\"Rewrite\" value=\"%s\"> ",_("Rewrite smb.conf file")); + printf("<input type=submit name=\"Commit\" value=\"%s\"> ",_("Commit")); + printf("<input type=submit name=\"GetWizardParams\" value=\"%s\">", _("Edit Parameter Values")); + printf("</center>\n"); + } + + printf("<hr>"); + printf("<center><table border=0>"); + printf("<tr><td><b>%s: </b></td>\n", _("Server Type")); + printf("<td><input type=radio name=\"ServerType\" value=\"0\" %s> %s </td>", ((role == ROLE_STANDALONE) ? "checked" : ""), _("Stand Alone")); + printf("<td><input type=radio name=\"ServerType\" value=\"1\" %s> %s </td>", ((role == ROLE_DOMAIN_MEMBER) ? "checked" : ""), _("Domain Member")); + printf("<td><input type=radio name=\"ServerType\" value=\"2\" %s> %s </td>", ((role == ROLE_DOMAIN_PDC) ? "checked" : ""), _("Domain Controller")); + printf("</tr>\n"); if (role == ROLE_DOMAIN_BDC) { - d_printf("<tr><td></td><td colspan=3><font color=\"#ff0000\">%s</font></td></tr>\n", _("Unusual Type in smb.conf - Please Select New Mode")); + printf("<tr><td></td><td colspan=3><font color=\"#ff0000\">%s</font></td></tr>\n", _("Unusual Type in smb.conf - Please Select New Mode")); } - d_printf("<tr><td><b>%s: </b></td>\n", _("Configure WINS As")); - d_printf("<td><input type=radio name=\"WINSType\" value=\"0\" %s> %s </td>", ((winstype == 0) ? "checked" : ""), _("Not Used")); - d_printf("<td><input type=radio name=\"WINSType\" value=\"1\" %s> %s </td>", ((winstype == 1) ? "checked" : ""), _("Server for client use")); - d_printf("<td><input type=radio name=\"WINSType\" value=\"2\" %s> %s </td>", ((winstype == 2) ? "checked" : ""), _("Client of another WINS server")); - d_printf("</tr>\n"); - d_printf("<tr><td></td><td></td><td></td><td>%s <input type=text size=\"16\" name=\"WINSAddr\" value=\"", _("Remote WINS Server")); + printf("<tr><td><b>%s: </b></td>\n", _("Configure WINS As")); + printf("<td><input type=radio name=\"WINSType\" value=\"0\" %s> %s </td>", ((winstype == 0) ? "checked" : ""), _("Not Used")); + printf("<td><input type=radio name=\"WINSType\" value=\"1\" %s> %s </td>", ((winstype == 1) ? "checked" : ""), _("Server for client use")); + printf("<td><input type=radio name=\"WINSType\" value=\"2\" %s> %s </td>", ((winstype == 2) ? "checked" : ""), _("Client of another WINS server")); + printf("</tr>\n"); + printf("<tr><td></td><td></td><td></td><td>%s <input type=text size=\"16\" name=\"WINSAddr\" value=\"", _("Remote WINS Server")); /* Print out the list of wins servers */ if(lp_wins_server_list()) { int i; const char **wins_servers = lp_wins_server_list(); - for(i = 0; wins_servers[i]; i++) d_printf("%s ", wins_servers[i]); + for(i = 0; wins_servers[i]; i++) printf("%s ", wins_servers[i]); } - d_printf("\"></td></tr>\n"); + printf("\"></td></tr>\n"); if (winstype == 3) { - d_printf("<tr><td></td><td colspan=3><font color=\"#ff0000\">%s</font></td></tr>\n", _("Error: WINS Server Mode and WINS Support both set in smb.conf")); - d_printf("<tr><td></td><td colspan=3><font color=\"#ff0000\">%s</font></td></tr>\n", _("Please Select desired WINS mode above.")); + printf("<tr><td></td><td colspan=3><font color=\"#ff0000\">%s</font></td></tr>\n", _("Error: WINS Server Mode and WINS Support both set in smb.conf")); + printf("<tr><td></td><td colspan=3><font color=\"#ff0000\">%s</font></td></tr>\n", _("Please Select desired WINS mode above.")); } - d_printf("<tr><td><b>%s: </b></td>\n", _("Expose Home Directories")); - d_printf("<td><input type=radio name=\"HomeExpo\" value=\"1\" %s> Yes</td>", (have_home == -1) ? "" : "checked "); - d_printf("<td><input type=radio name=\"HomeExpo\" value=\"0\" %s> No</td>", (have_home == -1 ) ? "checked" : ""); - d_printf("<td></td></tr>\n"); + printf("<tr><td><b>%s: </b></td>\n", _("Expose Home Directories")); + printf("<td><input type=radio name=\"HomeExpo\" value=\"1\" %s> Yes</td>", (have_home == -1) ? "" : "checked "); + printf("<td><input type=radio name=\"HomeExpo\" value=\"0\" %s> No</td>", (have_home == -1 ) ? "checked" : ""); + printf("<td></td></tr>\n"); /* Enable this when we are ready .... - * d_printf("<tr><td><b>%s: </b></td>\n", _("Is Print Server")); - * d_printf("<td><input type=radio name=\"PtrSvr\" value=\"1\" %s> Yes</td>"); - * d_printf("<td><input type=radio name=\"PtrSvr\" value=\"0\" %s> No</td>"); - * d_printf("<td></td></tr>\n"); + * printf("<tr><td><b>%s: </b></td>\n", _("Is Print Server")); + * printf("<td><input type=radio name=\"PtrSvr\" value=\"1\" %s> Yes</td>"); + * printf("<td><input type=radio name=\"PtrSvr\" value=\"0\" %s> No</td>"); + * printf("<td></td></tr>\n"); */ - d_printf("</table></center>"); - d_printf("<hr>"); + printf("</table></center>"); + printf("<hr>"); - d_printf("%s\n", _("The above configuration options will set multiple parameters and will generally assist with rapid Samba deployment.")); - d_printf("</form>\n"); + printf("%s\n", _("The above configuration options will set multiple parameters and will generally assist with rapid Samba deployment.")); + printf("</form>\n"); } @@ -793,7 +793,7 @@ static void globals_page(void) unsigned int parm_filter = FLAG_BASIC; int mode = 0; - d_printf("<H2>%s</H2>\n", _("Global Parameters")); + printf("<H2>%s</H2>\n", _("Global Parameters")); if (cgi_variable("Commit")) { commit_parameters(GLOBAL_SECTION_SNUM); @@ -807,7 +807,7 @@ static void globals_page(void) if ( cgi_variable("AdvMode")) mode = 1; - d_printf("<form name=\"swatform\" method=post action=globals>\n"); + printf("<form name=\"swatform\" method=post action=globals>\n"); ViewModeBoxes( mode ); switch ( mode ) { @@ -818,30 +818,30 @@ static void globals_page(void) parm_filter = FLAG_ADVANCED; break; } - d_printf("<br>\n"); + printf("<br>\n"); if (have_write_access) { - d_printf("<input type=submit name=\"Commit\" value=\"%s\">\n", + printf("<input type=submit name=\"Commit\" value=\"%s\">\n", _("Commit Changes")); } - d_printf("<input type=reset name=\"Reset Values\" value=\"%s\">\n", + printf("<input type=reset name=\"Reset Values\" value=\"%s\">\n", _("Reset Values")); - d_printf("<p>\n"); - d_printf("<table>\n"); + printf("<p>\n"); + printf("<table>\n"); show_parameters(GLOBAL_SECTION_SNUM, 1, parm_filter, 0); - d_printf("</table>\n"); - d_printf("</form>\n"); + printf("</table>\n"); + printf("</form>\n"); } /**************************************************************************** - display a shares editing page. share is in unix codepage, and must be in - dos codepage. FIXME !!! JRA. + display a shares editing page. share is in unix codepage, ****************************************************************************/ static void shares_page(void) { const char *share = cgi_variable("share"); char *s; + char *utf8_s; int snum = -1; int i; int mode = 0; @@ -850,7 +850,7 @@ static void shares_page(void) if (share) snum = lp_servicenumber(share); - d_printf("<H2>%s</H2>\n", _("Share Parameters")); + printf("<H2>%s</H2>\n", _("Share Parameters")); if (cgi_variable("Commit") && snum >= 0) { commit_parameters(snum); @@ -872,9 +872,9 @@ static void shares_page(void) snum = lp_servicenumber(share); } - d_printf("<FORM name=\"swatform\" method=post>\n"); + printf("<FORM name=\"swatform\" method=post>\n"); - d_printf("<table>\n"); + printf("<table>\n"); if ( cgi_variable("ViewMode") ) mode = atoi(cgi_variable("ViewMode")); @@ -892,50 +892,53 @@ static void shares_page(void) parm_filter = FLAG_ADVANCED; break; } - d_printf("<br><tr>\n"); - d_printf("<td><input type=submit name=selectshare value=\"%s\"></td>\n", _("Choose Share")); - d_printf("<td><select name=share>\n"); + printf("<br><tr>\n"); + printf("<td><input type=submit name=selectshare value=\"%s\"></td>\n", _("Choose Share")); + printf("<td><select name=share>\n"); if (snum < 0) - d_printf("<option value=\" \"> \n"); + printf("<option value=\" \"> \n"); for (i=0;i<lp_numservices();i++) { s = lp_servicename(i); if (s && (*s) && strcmp(s,"IPC$") && !lp_print_ok(i)) { - d_printf("<option %s value=\"%s\">%s\n", + push_utf8_allocate(&utf8_s, s); + printf("<option %s value=\"%s\">%s\n", (share && strcmp(share,s)==0)?"SELECTED":"", - s, s); + utf8_s, utf8_s); + SAFE_FREE(utf8_s); + } } - d_printf("</select></td>\n"); + printf("</select></td>\n"); if (have_write_access) { - d_printf("<td><input type=submit name=\"Delete\" value=\"%s\"></td>\n", _("Delete Share")); + printf("<td><input type=submit name=\"Delete\" value=\"%s\"></td>\n", _("Delete Share")); } - d_printf("</tr>\n"); - d_printf("</table>"); - d_printf("<table>"); + printf("</tr>\n"); + printf("</table>"); + printf("<table>"); if (have_write_access) { - d_printf("<tr>\n"); - d_printf("<td><input type=submit name=createshare value=\"%s\"></td>\n", _("Create Share")); - d_printf("<td><input type=text size=30 name=newshare></td></tr>\n"); + printf("<tr>\n"); + printf("<td><input type=submit name=createshare value=\"%s\"></td>\n", _("Create Share")); + printf("<td><input type=text size=30 name=newshare></td></tr>\n"); } - d_printf("</table>"); + printf("</table>"); if (snum >= 0) { if (have_write_access) { - d_printf("<input type=submit name=\"Commit\" value=\"%s\">\n", _("Commit Changes")); + printf("<input type=submit name=\"Commit\" value=\"%s\">\n", _("Commit Changes")); } - d_printf("<input type=reset name=\"Reset Values\" value=\"%s\">\n", _("Reset Values")); - d_printf("<p>\n"); + printf("<input type=reset name=\"Reset Values\" value=\"%s\">\n", _("Reset Values")); + printf("<p>\n"); } if (snum >= 0) { - d_printf("<table>\n"); + printf("<table>\n"); show_parameters(snum, 1, parm_filter, 0); - d_printf("</table>\n"); + printf("</table>\n"); } - d_printf("</FORM>\n"); + printf("</FORM>\n"); } /************************************************************* @@ -950,7 +953,7 @@ static BOOL change_password(const char *remote_machine, const char *user_name, pstring msg_str; if (demo_mode) { - d_printf("%s\n<p>", _("password change in demo mode rejected")); + printf("%s\n<p>", _("password change in demo mode rejected")); return False; } @@ -958,12 +961,12 @@ static BOOL change_password(const char *remote_machine, const char *user_name, ret = remote_password_change(remote_machine, user_name, old_passwd, new_passwd, err_str, sizeof(err_str)); if(*err_str) - d_printf("%s\n<p>", err_str); + printf("%s\n<p>", err_str); return ret; } if(!initialize_password_db(True)) { - d_printf("%s\n<p>", _("Can't setup password database vectors.")); + printf("%s\n<p>", _("Can't setup password database vectors.")); return False; } @@ -971,9 +974,9 @@ static BOOL change_password(const char *remote_machine, const char *user_name, msg_str, sizeof(msg_str)); if(*msg_str) - d_printf("%s\n<p>", msg_str); + printf("%s\n<p>", msg_str); if(*err_str) - d_printf("%s\n<p>", err_str); + printf("%s\n<p>", err_str); return ret; } @@ -989,7 +992,7 @@ static void chg_passwd(void) /* Make sure users name has been specified */ if (strlen(cgi_variable(SWAT_USER)) == 0) { - d_printf("<p>%s\n", _(" Must specify \"User Name\" ")); + printf("<p>%s\n", _(" Must specify \"User Name\" ")); return; } @@ -1005,26 +1008,26 @@ static void chg_passwd(void) */ if (((!am_root()) && (strlen( cgi_variable(OLD_PSWD)) <= 0)) || ((cgi_variable(CHG_R_PASSWD_FLAG)) && (strlen( cgi_variable(OLD_PSWD)) <= 0))) { - d_printf("<p>%s\n", _(" Must specify \"Old Password\" ")); + printf("<p>%s\n", _(" Must specify \"Old Password\" ")); return; } /* If changing a users password on a remote hosts we have to know what host */ if ((cgi_variable(CHG_R_PASSWD_FLAG)) && (strlen( cgi_variable(RHOST)) <= 0)) { - d_printf("<p>%s\n", _(" Must specify \"Remote Machine\" ")); + printf("<p>%s\n", _(" Must specify \"Remote Machine\" ")); return; } /* Make sure new passwords have been specified */ if ((strlen( cgi_variable(NEW_PSWD)) <= 0) || (strlen( cgi_variable(NEW2_PSWD)) <= 0)) { - d_printf("<p>%s\n", _(" Must specify \"New, and Re-typed Passwords\" ")); + printf("<p>%s\n", _(" Must specify \"New, and Re-typed Passwords\" ")); return; } /* Make sure new passwords was typed correctly twice */ if (strcmp(cgi_variable(NEW_PSWD), cgi_variable(NEW2_PSWD)) != 0) { - d_printf("<p>%s\n", _(" Re-typed password didn't match new password ")); + printf("<p>%s\n", _(" Re-typed password didn't match new password ")); return; } } @@ -1055,13 +1058,13 @@ static void chg_passwd(void) local_flags); if(cgi_variable(CHG_S_PASSWD_FLAG)) { - d_printf("<p>"); + printf("<p>"); if (rslt == True) { - d_printf(_(" The passwd for '%s' has been changed."), cgi_variable(SWAT_USER)); - d_printf("\n"); + printf(_(" The passwd for '%s' has been changed."), cgi_variable(SWAT_USER)); + printf("\n"); } else { - d_printf(_(" The passwd for '%s' has NOT been changed."), cgi_variable(SWAT_USER)); - d_printf("\n"); + printf(_(" The passwd for '%s' has NOT been changed."), cgi_variable(SWAT_USER)); + printf("\n"); } } @@ -1085,43 +1088,43 @@ static void passwd_page(void) if (!new_name) new_name = ""; - d_printf("<H2>%s</H2>\n", _("Server Password Management")); + printf("<H2>%s</H2>\n", _("Server Password Management")); - d_printf("<FORM name=\"swatform\" method=post>\n"); + printf("<FORM name=\"swatform\" method=post>\n"); - d_printf("<table>\n"); + printf("<table>\n"); /* * Create all the dialog boxes for data collection */ - d_printf("<tr><td> %s : </td>\n", _("User Name")); - d_printf("<td><input type=text size=30 name=%s value=%s></td></tr> \n", SWAT_USER, new_name); + printf("<tr><td> %s : </td>\n", _("User Name")); + printf("<td><input type=text size=30 name=%s value=%s></td></tr> \n", SWAT_USER, new_name); if (!am_root()) { - d_printf("<tr><td> %s : </td>\n", _("Old Password")); - d_printf("<td><input type=password size=30 name=%s></td></tr> \n",OLD_PSWD); + printf("<tr><td> %s : </td>\n", _("Old Password")); + printf("<td><input type=password size=30 name=%s></td></tr> \n",OLD_PSWD); } - d_printf("<tr><td> %s : </td>\n", _("New Password")); - d_printf("<td><input type=password size=30 name=%s></td></tr>\n",NEW_PSWD); - d_printf("<tr><td> %s : </td>\n", _("Re-type New Password")); - d_printf("<td><input type=password size=30 name=%s></td></tr>\n",NEW2_PSWD); - d_printf("</table>\n"); + printf("<tr><td> %s : </td>\n", _("New Password")); + printf("<td><input type=password size=30 name=%s></td></tr>\n",NEW_PSWD); + printf("<tr><td> %s : </td>\n", _("Re-type New Password")); + printf("<td><input type=password size=30 name=%s></td></tr>\n",NEW2_PSWD); + printf("</table>\n"); /* * Create all the control buttons for requesting action */ - d_printf("<input type=submit name=%s value=\"%s\">\n", + printf("<input type=submit name=%s value=\"%s\">\n", CHG_S_PASSWD_FLAG, _("Change Password")); if (demo_mode || am_root()) { - d_printf("<input type=submit name=%s value=\"%s\">\n", + printf("<input type=submit name=%s value=\"%s\">\n", ADD_USER_FLAG, _("Add New User")); - d_printf("<input type=submit name=%s value=\"%s\">\n", + printf("<input type=submit name=%s value=\"%s\">\n", DELETE_USER_FLAG, _("Delete User")); - d_printf("<input type=submit name=%s value=\"%s\">\n", + printf("<input type=submit name=%s value=\"%s\">\n", DISABLE_USER_FLAG, _("Disable User")); - d_printf("<input type=submit name=%s value=\"%s\">\n", + printf("<input type=submit name=%s value=\"%s\">\n", ENABLE_USER_FLAG, _("Enable User")); } - d_printf("<p></FORM>\n"); + printf("<p></FORM>\n"); /* * Do some work if change, add, disable or enable was @@ -1132,35 +1135,35 @@ static void passwd_page(void) chg_passwd(); } - d_printf("<H2>%s</H2>\n", _("Client/Server Password Management")); + printf("<H2>%s</H2>\n", _("Client/Server Password Management")); - d_printf("<FORM name=\"swatform\" method=post>\n"); + printf("<FORM name=\"swatform\" method=post>\n"); - d_printf("<table>\n"); + printf("<table>\n"); /* * Create all the dialog boxes for data collection */ - d_printf("<tr><td> %s : </td>\n", _("User Name")); - d_printf("<td><input type=text size=30 name=%s value=%s></td></tr>\n",SWAT_USER, new_name); - d_printf("<tr><td> %s : </td>\n", _("Old Password")); - d_printf("<td><input type=password size=30 name=%s></td></tr>\n",OLD_PSWD); - d_printf("<tr><td> %s : </td>\n", _("New Password")); - d_printf("<td><input type=password size=30 name=%s></td></tr>\n",NEW_PSWD); - d_printf("<tr><td> %s : </td>\n", _("Re-type New Password")); - d_printf("<td><input type=password size=30 name=%s></td></tr>\n",NEW2_PSWD); - d_printf("<tr><td> %s : </td>\n", _("Remote Machine")); - d_printf("<td><input type=text size=30 name=%s></td></tr>\n",RHOST); - - d_printf("</table>"); + printf("<tr><td> %s : </td>\n", _("User Name")); + printf("<td><input type=text size=30 name=%s value=%s></td></tr>\n",SWAT_USER, new_name); + printf("<tr><td> %s : </td>\n", _("Old Password")); + printf("<td><input type=password size=30 name=%s></td></tr>\n",OLD_PSWD); + printf("<tr><td> %s : </td>\n", _("New Password")); + printf("<td><input type=password size=30 name=%s></td></tr>\n",NEW_PSWD); + printf("<tr><td> %s : </td>\n", _("Re-type New Password")); + printf("<td><input type=password size=30 name=%s></td></tr>\n",NEW2_PSWD); + printf("<tr><td> %s : </td>\n", _("Remote Machine")); + printf("<td><input type=text size=30 name=%s></td></tr>\n",RHOST); + + printf("</table>"); /* * Create all the control buttons for requesting action */ - d_printf("<input type=submit name=%s value=\"%s\">", + printf("<input type=submit name=%s value=\"%s\">", CHG_R_PASSWD_FLAG, _("Change Password")); - d_printf("<p></FORM>\n"); + printf("<p></FORM>\n"); /* * Do some work if a request has been made to change the @@ -1188,13 +1191,13 @@ static void printers_page(void) if (share) snum = lp_servicenumber(share); - d_printf("<H2>%s</H2>\n", _("Printer Parameters")); + printf("<H2>%s</H2>\n", _("Printer Parameters")); - d_printf("<H3>%s</H3>\n", _("Important Note:")); - d_printf(_("Printer names marked with [*] in the Choose Printer drop-down box ")); - d_printf(_("are autoloaded printers from ")); - d_printf("<A HREF=\"/swat/help/smb.conf.5.html#printcapname\" target=\"docs\">%s</A>\n", _("Printcap Name")); - d_printf("%s\n", _("Attempting to delete these printers from SWAT will have no effect.")); + printf("<H3>%s</H3>\n", _("Important Note:")); + printf(_("Printer names marked with [*] in the Choose Printer drop-down box ")); + printf(_("are autoloaded printers from ")); + printf("<A HREF=\"/swat/help/smb.conf.5.html#printcapname\" target=\"docs\">%s</A>\n", _("Printcap Name")); + printf("%s\n", _("Attempting to delete these printers from SWAT will have no effect.")); if (cgi_variable("Commit") && snum >= 0) { commit_parameters(snum); @@ -1221,7 +1224,7 @@ static void printers_page(void) snum = lp_servicenumber(share); } - d_printf("<FORM name=\"swatform\" method=post>\n"); + printf("<FORM name=\"swatform\" method=post>\n"); if ( cgi_variable("ViewMode") ) mode = atoi(cgi_variable("ViewMode")); @@ -1239,53 +1242,53 @@ static void printers_page(void) parm_filter = FLAG_ADVANCED; break; } - d_printf("<table>\n"); - d_printf("<tr><td><input type=submit name=\"selectshare\" value=\"%s\"></td>\n", _("Choose Printer")); - d_printf("<td><select name=\"share\">\n"); + printf("<table>\n"); + printf("<tr><td><input type=submit name=\"selectshare\" value=\"%s\"></td>\n", _("Choose Printer")); + printf("<td><select name=\"share\">\n"); if (snum < 0 || !lp_print_ok(snum)) - d_printf("<option value=\" \"> \n"); + printf("<option value=\" \"> \n"); for (i=0;i<lp_numservices();i++) { s = lp_servicename(i); if (s && (*s) && strcmp(s,"IPC$") && lp_print_ok(i)) { if (i >= iNumNonAutoPrintServices) - d_printf("<option %s value=\"%s\">[*]%s\n", + printf("<option %s value=\"%s\">[*]%s\n", (share && strcmp(share,s)==0)?"SELECTED":"", s, s); else - d_printf("<option %s value=\"%s\">%s\n", + printf("<option %s value=\"%s\">%s\n", (share && strcmp(share,s)==0)?"SELECTED":"", s, s); } } - d_printf("</select></td>"); + printf("</select></td>"); if (have_write_access) { - d_printf("<td><input type=submit name=\"Delete\" value=\"%s\"></td>\n", _("Delete Printer")); + printf("<td><input type=submit name=\"Delete\" value=\"%s\"></td>\n", _("Delete Printer")); } - d_printf("</tr>"); - d_printf("</table>\n"); + printf("</tr>"); + printf("</table>\n"); if (have_write_access) { - d_printf("<table>\n"); - d_printf("<tr><td><input type=submit name=\"createshare\" value=\"%s\"></td>\n", _("Create Printer")); - d_printf("<td><input type=text size=30 name=\"newshare\"></td></tr>\n"); - d_printf("</table>"); + printf("<table>\n"); + printf("<tr><td><input type=submit name=\"createshare\" value=\"%s\"></td>\n", _("Create Printer")); + printf("<td><input type=text size=30 name=\"newshare\"></td></tr>\n"); + printf("</table>"); } if (snum >= 0) { if (have_write_access) { - d_printf("<input type=submit name=\"Commit\" value=\"%s\">\n", _("Commit Changes")); + printf("<input type=submit name=\"Commit\" value=\"%s\">\n", _("Commit Changes")); } - d_printf("<input type=reset name=\"Reset Values\" value=\"%s\">\n", _("Reset Values")); - d_printf("<p>\n"); + printf("<input type=reset name=\"Reset Values\" value=\"%s\">\n", _("Reset Values")); + printf("<p>\n"); } if (snum >= 0) { - d_printf("<table>\n"); + printf("<table>\n"); show_parameters(snum, 1, parm_filter, 1); - d_printf("</table>\n"); + printf("</table>\n"); } - d_printf("</FORM>\n"); + printf("</FORM>\n"); } diff --git a/swat/include/header.html b/swat/include/header.html index f964133316a..c482aedcb8e 100644 --- a/swat/include/header.html +++ b/swat/include/header.html @@ -1,6 +1,7 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <HTML> <HEAD> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <TITLE>Samba Web Administration Tool</TITLE> </HEAD> <BODY bgcolor="white"> diff --git a/swat/lang/ja/help/welcome.html b/swat/lang/ja/help/welcome.html index 240ad22ceff..bcae8e9a5e9 100644 --- a/swat/lang/ja/help/welcome.html +++ b/swat/lang/ja/help/welcome.html @@ -1,69 +1,69 @@ -<h3>SWAT へようこそ!</h3>
+<h3>SWAT 縺ク繧医≧縺薙◎!</h3>
-上のボタンをクリックして設定を行ってください。
+荳翫ョ繝懊ち繝ウ繧偵け繝ェ繝繧ッ縺励※險ュ螳壹r陦後▲縺ヲ縺上□縺輔>縲
-<h3><a href="/swat/help/samba.7.html" target="docs">Samba</a> ドキュメント</h3>
+<h3><a href="/swat/help/samba.7.html" target="docs">Samba</a> 繝峨く繝・繝。繝ウ繝</h3>
<ul>
- <li><b>デーモン</b>
+ <li><b>繝繝シ繝「繝ウ</b>
<ul>
- <li><a href="/swat/help/smbd.8.html" target="docs">smbd</a> - SMB デーモン
- <li><a href="/swat/help/nmbd.8.html" target="docs">nmbd</a> - NetBIOS ネームサーバ
- <li><a href="/swat/help/winbindd.8.html" target="docs">winbindd</a> - winbind デーモン
+ <li><a href="/swat/help/smbd.8.html" target="docs">smbd</a> - SMB 繝繝シ繝「繝ウ
+ <li><a href="/swat/help/nmbd.8.html" target="docs">nmbd</a> - NetBIOS 繝阪シ繝繧オ繝シ繝
+ <li><a href="/swat/help/winbindd.8.html" target="docs">winbindd</a> - winbind 繝繝シ繝「繝ウ
</ul>
- <li><b>設定ファイル</b>
+ <li><b>險ュ螳壹ヵ繧。繧、繝ォ</b>
<ul>
- <li><a href="/swat/help/smb.conf.5.html" target="docs">smb.conf</a> - Samba 設定ファイル
- <li><a href="/swat/help/lmhosts.5.html" target="docs">lmhosts</a> - NetBIOS の hosts ファイル
- <li><a href="/swat/help/smbpasswd.5.html" target="docs">smbpasswd</a> - SMB パスワードファイル
+ <li><a href="/swat/help/smb.conf.5.html" target="docs">smb.conf</a> - Samba 險ュ螳壹ヵ繧。繧、繝ォ
+ <li><a href="/swat/help/lmhosts.5.html" target="docs">lmhosts</a> - NetBIOS 縺ョ hosts 繝輔ぃ繧、繝ォ
+ <li><a href="/swat/help/smbpasswd.5.html" target="docs">smbpasswd</a> - SMB 繝代せ繝ッ繝シ繝峨ヵ繧。繧、繝ォ
</ul>
- <li><b>管理ユーティリティ</b>
+ <li><b>邂。逅繝ヲ繝シ繝繧」繝ェ繝繧」</b>
<ul>
- <li><a href="/swat/help/smbcontrol.1.html" target="docs">smbcontrol</a> - Samba デーモンへのコントロールメッセージの送出
- <li><a href="/swat/help/smbpasswd.8.html" target="docs">smbpasswd</a> - SMB パスワードの管理
- <li><a href="/swat/help/swat.8.html" target="docs">SWAT</a> - Web 設定ツール
- <li><a href="/swat/help/net.8.html" target="docs">net</a> - Samba およびリモートの CIFS サーバの管理ツール
- <li><a href="/swat/help/pdbedit.8.html" target="docs">pdbedit</a> - Samba のユーザアカウント管理ツール
- <li><a href="/swat/help/tdbbackup.8.html" target="docs">tdbbackup</a> - TDB データベースのバックアップツール
+ <li><a href="/swat/help/smbcontrol.1.html" target="docs">smbcontrol</a> - Samba 繝繝シ繝「繝ウ縺ク縺ョ繧ウ繝ウ繝医Ο繝シ繝ォ繝。繝繧サ繝シ繧ク縺ョ騾∝コ
+ <li><a href="/swat/help/smbpasswd.8.html" target="docs">smbpasswd</a> - SMB 繝代せ繝ッ繝シ繝峨ョ邂。逅
+ <li><a href="/swat/help/swat.8.html" target="docs">SWAT</a> - Web 險ュ螳壹ヤ繝シ繝ォ
+ <li><a href="/swat/help/net.8.html" target="docs">net</a> - Samba 縺翫h縺ウ繝ェ繝「繝シ繝医ョ CIFS 繧オ繝シ繝舌ョ邂。逅繝繝シ繝ォ
+ <li><a href="/swat/help/pdbedit.8.html" target="docs">pdbedit</a> - Samba 縺ョ繝ヲ繝シ繧カ繧「繧ォ繧ヲ繝ウ繝育ョ。逅繝繝シ繝ォ
+ <li><a href="/swat/help/tdbbackup.8.html" target="docs">tdbbackup</a> - TDB 繝繝シ繧ソ繝吶シ繧ケ縺ョ繝舌ャ繧ッ繧「繝繝励ヤ繝シ繝ォ
</ul>
- <li><b>クライアントツール</b>
+ <li><b>繧ッ繝ゥ繧、繧「繝ウ繝医ヤ繝シ繝ォ</b>
<ul>
- <li><a href="/swat/help/rpcclient.1.html" target="docs">rpcclient</a> - コマンドラインの MS-RPC クライアント
- <li><a href="/swat/help/smbtar.1.html" target="docs">smbtar</a> - SMB バックアップツール
- <li><a href="/swat/help/smbclient.1.html" target="docs">smbclient</a> - コマンドラインの SMB クライアント
- <li><a href="/swat/help/smbmnt.8.html" target="docs">smbmnt</a> - Linux 上の SMB ファイルシステムをマウントする際の補助ツール
- <li><a href="/swat/help/smbmount.8.html" target="docs">smbmount</a> - Linux における SMB ファイルシステムのマウントを実現するユーザ空間のツール
- <li><a href="/swat/help/smbspool.8.html" target="docs">smbspool</a> - コマンドラインの SMB 印刷クライアント
- <li><a href="/swat/help/smbumount.8.html" target="docs">smbumount</a> - Linux における SMB ファイルシステムのアンマウントを実現するユーザ空間のツール
- <li><a href="/swat/help/ntlm_auth.1.html" target="docs">ntlm_auth</a> - 別プログラムからの NTLM 認証の使用を実現
- <li><a href="/swat/help/smbcquotas.1.html" target="docs">smbcquotas</a> - NTFS 5 共有のクォータ情報の設定と取得
- <li><a href="/swat/help/smbsh.1.html" target="docs">smbsh</a> - UNIX シェルを用いたリモート SMB 共有へのアクセスを実現
- <li><a href="/swat/help/smbtree.1.html" target="docs">smbtree</a> - テキストベースの SMB ネットワークブラウジング
- <li><a href="/swat/help/smbspool.8.html" target="docs">smbspool</a> - 印刷ジョブを SMB プリンタに送信
+ <li><a href="/swat/help/rpcclient.1.html" target="docs">rpcclient</a> - 繧ウ繝槭Φ繝峨Λ繧、繝ウ縺ョ MS-RPC 繧ッ繝ゥ繧、繧「繝ウ繝
+ <li><a href="/swat/help/smbtar.1.html" target="docs">smbtar</a> - SMB 繝舌ャ繧ッ繧「繝繝励ヤ繝シ繝ォ
+ <li><a href="/swat/help/smbclient.1.html" target="docs">smbclient</a> - 繧ウ繝槭Φ繝峨Λ繧、繝ウ縺ョ SMB 繧ッ繝ゥ繧、繧「繝ウ繝
+ <li><a href="/swat/help/smbmnt.8.html" target="docs">smbmnt</a> - Linux 荳翫ョ SMB 繝輔ぃ繧、繝ォ繧キ繧ケ繝繝繧偵槭え繝ウ繝医☆繧矩圀縺ョ陬懷勧繝繝シ繝ォ
+ <li><a href="/swat/help/smbmount.8.html" target="docs">smbmount</a> - Linux 縺ォ縺翫¢繧 SMB 繝輔ぃ繧、繝ォ繧キ繧ケ繝繝縺ョ繝槭え繝ウ繝医r螳溽樟縺吶k繝ヲ繝シ繧カ遨コ髢薙ョ繝繝シ繝ォ
+ <li><a href="/swat/help/smbspool.8.html" target="docs">smbspool</a> - 繧ウ繝槭Φ繝峨Λ繧、繝ウ縺ョ SMB 蜊ー蛻キ繧ッ繝ゥ繧、繧「繝ウ繝
+ <li><a href="/swat/help/smbumount.8.html" target="docs">smbumount</a> - Linux 縺ォ縺翫¢繧 SMB 繝輔ぃ繧、繝ォ繧キ繧ケ繝繝縺ョ繧「繝ウ繝槭え繝ウ繝医r螳溽樟縺吶k繝ヲ繝シ繧カ遨コ髢薙ョ繝繝シ繝ォ
+ <li><a href="/swat/help/ntlm_auth.1.html" target="docs">ntlm_auth</a> - 蛻・繝励Ο繧ー繝ゥ繝縺九i縺ョ NTLM 隱崎ィシ縺ョ菴ソ逕ィ繧貞ョ溽樟
+ <li><a href="/swat/help/smbcquotas.1.html" target="docs">smbcquotas</a> - NTFS 5 蜈ア譛峨ョ繧ッ繧ゥ繝シ繧ソ諠蝣ア縺ョ險ュ螳壹→蜿門セ
+ <li><a href="/swat/help/smbsh.1.html" target="docs">smbsh</a> - UNIX 繧キ繧ァ繝ォ繧堤畑縺縺溘Μ繝「繝シ繝 SMB 蜈ア譛峨∈縺ョ繧「繧ッ繧サ繧ケ繧貞ョ溽樟
+ <li><a href="/swat/help/smbtree.1.html" target="docs">smbtree</a> - 繝繧ュ繧ケ繝医吶シ繧ケ縺ョ SMB 繝阪ャ繝医Ρ繝シ繧ッ繝悶Λ繧ヲ繧ク繝ウ繧ー
+ <li><a href="/swat/help/smbspool.8.html" target="docs">smbspool</a> - 蜊ー蛻キ繧ク繝ァ繝悶r SMB 繝励Μ繝ウ繧ソ縺ォ騾∽ソ。
</ul>
- <li><b>診断ユーティリティ</b>
+ <li><b>險コ譁ュ繝ヲ繝シ繝繧」繝ェ繝繧」</b>
<ul>
- <li><a href="/swat/help/smbstatus.1.html" target="docs">smbstatus</a> - Samba の監視
- <li><a href="/swat/help/testparm.1.html" target="docs">testparm</a> - 設定ファイルの整合性の検査
- <li><a href="/swat/help/testprns.1.html" target="docs">testprns</a> - プリンタ設定の検査
- <li><a href="/swat/help/nmblookup.1.html" target="docs">nmblookup</a> - NetBIOS 名の検索ツール
- <li><a href="/swat/help/wbinfo.1.html" target="docs">wbinfo</a> - winbind 情報の取得ツール
+ <li><a href="/swat/help/smbstatus.1.html" target="docs">smbstatus</a> - Samba 縺ョ逶」隕
+ <li><a href="/swat/help/testparm.1.html" target="docs">testparm</a> - 險ュ螳壹ヵ繧。繧、繝ォ縺ョ謨エ蜷域ァ縺ョ讀懈渊
+ <li><a href="/swat/help/testprns.1.html" target="docs">testprns</a> - 繝励Μ繝ウ繧ソ險ュ螳壹ョ讀懈渊
+ <li><a href="/swat/help/nmblookup.1.html" target="docs">nmblookup</a> - NetBIOS 蜷阪ョ讀懃エ「繝繝シ繝ォ
+ <li><a href="/swat/help/wbinfo.1.html" target="docs">wbinfo</a> - winbind 諠蝣ア縺ョ蜿門セ励ヤ繝シ繝ォ
</ul>
- <li><b>その他のユーティリティ</b>
+ <li><b>縺昴ョ莉悶ョ繝ヲ繝シ繝繧」繝ェ繝繧」</b>
<ul>
- <li><a href="/swat/help/profiles.1.html" target="docs">profiles</a> - 別ドメインへのプロファイルの移行
- <li><a href="/swat/help/editreg.1.html" target="docs">editreg</a> - Windows レジストリファイルの編集
- <li><a href="/swat/help/log2pcap.1.html" target="docs">log2pcap</a> - Samba のログファイルから pcap ファイルの生成
+ <li><a href="/swat/help/profiles.1.html" target="docs">profiles</a> - 蛻・繝峨Γ繧、繝ウ縺ク縺ョ繝励Ο繝輔ぃ繧、繝ォ縺ョ遘サ陦
+ <li><a href="/swat/help/editreg.1.html" target="docs">editreg</a> - Windows 繝ャ繧ク繧ケ繝医Μ繝輔ぃ繧、繝ォ縺ョ邱ィ髮
+ <li><a href="/swat/help/log2pcap.1.html" target="docs">log2pcap</a> - Samba 縺ョ繝ュ繧ー繝輔ぃ繧、繝ォ縺九i pcap 繝輔ぃ繧、繝ォ縺ョ逕滓
</ul>
- <li><b>書籍</b>
+ <li><b>譖ク邀</b>
<ul>
- <li><a href="/swat/using_samba/toc.html" target="docs">Using Samba 第二版</a> - 著者: Jay Ts, Robert Eckstein, David Collier-Brown
- <li><a href="/swat/help/Samba-HOWTO-Collection.html">Samba HOWTO コレクション</a>
+ <li><a href="/swat/using_samba/toc.html" target="docs">Using Samba 隨ャ莠檎沿</a> - 闡苓: Jay Ts, Robert Eckstein, David Collier-Brown
+ <li><a href="/swat/help/Samba-HOWTO-Collection.html">Samba HOWTO 繧ウ繝ャ繧ッ繧キ繝ァ繝ウ</a>
</ul>
</ul>
- <h3>フィードバック</h3>
+ <h3>繝輔ぅ繝シ繝峨ヰ繝繧ッ</h3>
- このバージョンの SWAT に関する問題についての議論を行ないたい方は、
- <A HREF="http://lists.samba.org/">samba</A> メーリングリストへの参加をお願いします。
-<small>(もしくは <A HREF="http://www.samba.gr.jp/ml/">sugj-tech</A> メーリングリストに日本語でお願いします)</small>
+ 縺薙ョ繝舌シ繧ク繝ァ繝ウ縺ョ SWAT 縺ォ髢「縺吶k蝠城。後↓縺、縺縺ヲ縺ョ隴ー隲悶r陦後↑縺縺溘>譁ケ縺ッ縲
+ <A HREF="http://lists.samba.org/">samba</A> 繝。繝シ繝ェ繝ウ繧ー繝ェ繧ケ繝医∈縺ョ蜿ょ刈繧偵♀鬘倥>縺励∪縺吶
+<small>(繧ゅ@縺上ッ <A HREF="http://www.samba.gr.jp/ml/">sugj-tech</A> 繝。繝シ繝ェ繝ウ繧ー繝ェ繧ケ繝医↓譌・譛ャ隱槭〒縺企。倥>縺励∪縺)</small>
diff --git a/swat/lang/ja/include/footer.html b/swat/lang/ja/include/footer.html deleted file mode 100644 index 7c3b483684c..00000000000 --- a/swat/lang/ja/include/footer.html +++ /dev/null @@ -1,3 +0,0 @@ -</TD></TR></TABLE></CENTER> -</BODY> -</HTML> diff --git a/swat/lang/ja/include/header.html b/swat/lang/ja/include/header.html deleted file mode 100644 index 2fbe9bb7546..00000000000 --- a/swat/lang/ja/include/header.html +++ /dev/null @@ -1,12 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> -<HTML> -<HEAD> -<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS"> -<TITLE>Samba Web Administration Tool</TITLE> -<link rel="STYLESHEET" type="text/css" href="/swat/include/header_css.html"> -</HEAD> -<BODY bgcolor="white"> -<CENTER> -<IMG SRC="/swat/images/samba.gif" ALT="[ Samba ]" border=0><BR> -<TABLE WIDTH="98%" CELLSPACING=1 CELLPADDING=4 BORDER=1> -<TR><TD BGCOLOR="#ddddd0"> diff --git a/swat/lang/ja/include/header.nocss.html b/swat/lang/ja/include/header.nocss.html deleted file mode 100644 index 56d13dbc6d1..00000000000 --- a/swat/lang/ja/include/header.nocss.html +++ /dev/null @@ -1,11 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> -<HTML> -<HEAD> -<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS"> -<TITLE>Samba Web Administration Tool</TITLE> -</HEAD> -<BODY bgcolor="white"> -<CENTER> -<IMG SRC="/swat/images/samba.gif" ALT="[ Samba ]" border=0><BR> -<TABLE WIDTH="98%" CELLSPACING=1 CELLPADDING=4 BORDER=1> -<TR><TD BGCOLOR="#ddddd0"> diff --git a/swat/lang/ja/include/header_css.html b/swat/lang/ja/include/header_css.html deleted file mode 100644 index b70876b6f82..00000000000 --- a/swat/lang/ja/include/header_css.html +++ /dev/null @@ -1 +0,0 @@ -.i18n_translated_parm {color: #555555} diff --git a/swat/lang/tr/help/welcome.html b/swat/lang/tr/help/welcome.html index 617f3678d39..2dc4c092a0a 100644 --- a/swat/lang/tr/help/welcome.html +++ b/swat/lang/tr/help/welcome.html @@ -1,8 +1,8 @@ -<h3>Swat'a Hogeldiniz!</h3> +<h3>Swat'a Hoナ殀eldiniz!</h3> -Yukardaki dmelerden birini kullanarak bir ayar eylemi se輅n. +Yukarトアdaki dテシト殞elerden birini kullanarak bir ayar eylemi seテァin. -<h3><a href="/swat/help/samba.7.html" target="docs">Samba</a> Dkmantasyon</h3> +<h3><a href="/swat/help/samba.7.html" target="docs">Samba</a> Dテカkテシmantasyon</h3> <ul> <li><b>Sunucular</b> @@ -11,59 +11,59 @@ Yukardaki dmelerden birini kullanarak bir ayar eylemi se輅n. <li><a href="/swat/help/nmbd.8.html" target="docs">nmbd</a> - NetBIOS isim sunucusu <li><a href="/swat/help/winbindd.8.html" target="docs">winbindd</a> - winbind sunucusu </ul> - <li><b>Ayar dosyalar</b> + <li><b>Ayar dosyalarトア</b> <ul> - <li><a href="/swat/help/smb.conf.5.html" target="docs">smb.conf</a> - ana Samba ayar dosyas - <li><a href="/swat/help/lmhosts.5.html" target="docs">lmhosts</a> - NetBIOS hosts dosyas - <li><a href="/swat/help/smbpasswd.5.html" target="docs">smbpasswd</a> - SMB ifre dosyas + <li><a href="/swat/help/smb.conf.5.html" target="docs">smb.conf</a> - ana Samba ayar dosyasトア + <li><a href="/swat/help/lmhosts.5.html" target="docs">lmhosts</a> - NetBIOS hosts dosyasトア + <li><a href="/swat/help/smbpasswd.5.html" target="docs">smbpasswd</a> - SMB ナ殃fre dosyasトア </ul> - <li><b>Ynetim Ara輙ar</b> + <li><b>Yテカnetim Araテァlarトア</b> <ul> - <li><a href="/swat/help/smbcontrol.1.html" target="docs">smbcontrol</a> - Samba sunucularna kontrol iletileri gnderir - <li><a href="/swat/help/smbpasswd.8.html" target="docs">smbpasswd</a> - SMB ifrelerini dzenler - <li><a href="/swat/help/swat.8.html" target="docs">SWAT</a> - web arayzl ayar arac - <li><a href="/swat/help/make_smbcodepage.1.html" target="docs">make_smbcodepage</a> - kod sayfas oluturur - <li><a href="/swat/help/make_unicodemap.1.html" target="docs">make_unicodemap</a> - unicode eleme dosyas oluturur - <li><a href="/swat/help/smbrun.1.html" target="docs">smbrun</a> - i輳el smbd arac + <li><a href="/swat/help/smbcontrol.1.html" target="docs">smbcontrol</a> - Samba sunucularトアna kontrol iletileri gテカnderir + <li><a href="/swat/help/smbpasswd.8.html" target="docs">smbpasswd</a> - SMB ナ殃frelerini dテシzenler + <li><a href="/swat/help/swat.8.html" target="docs">SWAT</a> - web arayテシzlテシ ayar aracトア + <li><a href="/swat/help/make_smbcodepage.1.html" target="docs">make_smbcodepage</a> - kod sayfasトア oluナ殳urur + <li><a href="/swat/help/make_unicodemap.1.html" target="docs">make_unicodemap</a> - unicode eナ殕eナ殞e dosyasトア oluナ殳urur + <li><a href="/swat/help/smbrun.1.html" target="docs">smbrun</a> - iテァsel smbd aracトア </ul> - <li><b>ンstemci Ara輙ar</b> + <li><b>トーstemci Araテァlarトア</b> <ul> - <li><a href="/swat/help/rpcclient.1.html" target="docs">rpcclient</a> - komut satr MS-RPC istemcisi - <li><a href="/swat/help/smbtar.1.html" target="docs">smbtar</a> - SMB yedekleme arac - <li><a href="/swat/help/smbclient.1.html" target="docs">smbclient</a> - komut satr SMB istemcisi - <li><a href="/swat/help/smbmnt.8.html" target="docs">smbmnt</a> - Linux makinalarna SMB dosya sistemlerini balamak i輅n yardmc ara - <li><a href="/swat/help/smbmount.8.html" target="docs">smbmount</a> - Linux altnda SMB dosya sistemlerini balamak i輅n kullanc arac - <li><a href="/swat/help/smbspool.8.html" target="docs">smbspool</a> - komut satr SMB yazc istemcisi - <li><a href="/swat/help/smbumount.8.html" target="docs">smbumount</a> - Linux altnda SMB dosya sistemlerini 銹zmek i輅n kullanc arac + <li><a href="/swat/help/rpcclient.1.html" target="docs">rpcclient</a> - komut satトアrトア MS-RPC istemcisi + <li><a href="/swat/help/smbtar.1.html" target="docs">smbtar</a> - SMB yedekleme aracトア + <li><a href="/swat/help/smbclient.1.html" target="docs">smbclient</a> - komut satトアrトア SMB istemcisi + <li><a href="/swat/help/smbmnt.8.html" target="docs">smbmnt</a> - Linux makinalarトアna SMB dosya sistemlerini baト殕amak iテァin yardトアmcトア araテァ + <li><a href="/swat/help/smbmount.8.html" target="docs">smbmount</a> - Linux altトアnda SMB dosya sistemlerini baト殕amak iテァin kullanトアcトア aracトア + <li><a href="/swat/help/smbspool.8.html" target="docs">smbspool</a> - komut satトアrトア SMB yazトアcトア istemcisi + <li><a href="/swat/help/smbumount.8.html" target="docs">smbumount</a> - Linux altトアnda SMB dosya sistemlerini テァテカzmek iテァin kullanトアcトア aracトア </ul> - <li><b>Tehis Ara輙ar</b> + <li><b>Teナ殄is Araテァlarトア</b> <ul> - <li><a href="/swat/help/smbstatus.1.html" target="docs">smbstatus</a> - Samba gzlemcisi - <li><a href="/swat/help/testparm.1.html" target="docs">testparm</a> - ayar dosyasn kontrol eder - <li><a href="/swat/help/testprns.1.html" target="docs">testprns</a> - yazc ayarlarn kontrol eder - <li><a href="/swat/help/nmblookup.1.html" target="docs">nmblookup</a> - NetBIOS isim sorgulama arac + <li><a href="/swat/help/smbstatus.1.html" target="docs">smbstatus</a> - Samba gテカzlemcisi + <li><a href="/swat/help/testparm.1.html" target="docs">testparm</a> - ayar dosyasトアnトア kontrol eder + <li><a href="/swat/help/testprns.1.html" target="docs">testprns</a> - yazトアcトア ayarlarトアnトア kontrol eder + <li><a href="/swat/help/nmblookup.1.html" target="docs">nmblookup</a> - NetBIOS isim sorgulama aracトア </ul> <li><b>Kitaplar</b> <ul> - <li><a href="/swat/using_samba/index.html" target="docs">Samba'y Kullanmak</a> - Yazan: Robert Eckstein, David Collier-Brown ve Peter Kelly + <li><a href="/swat/using_samba/index.html" target="docs">Samba'yトア Kullanmak</a> - Yazan: Robert Eckstein, David Collier-Brown ve Peter Kelly </ul> - <li><b>Samba HOWTO (Nasl Yaplr?) Koleksiyonu</b></li> + <li><b>Samba HOWTO (Nasトアl Yapトアlトアr?) Koleksiyonu</b></li> <ul> - <li><a href="/swat/help/Samba-HOWTO-Collection.html">Btn koleksiyon (tek dosya)</a> + <li><a href="/swat/help/Samba-HOWTO-Collection.html">Bテシtテシn koleksiyon (tek dosya)</a> <li><a href="/swat/help/DOMAIN_MEMBER.html">Samba 2.x'de security = domain </a> - <li><a href="/swat/help/winbind.html">Winbind Kullanarak Windows NT ve UNIX Arasnda Birleik Sistem Girii</a> - <li><a href="/swat/help/msdfs_setup.html">Samba'y bir MS-DFS Sunucusu Olarak Ayarlamak</a> - <li><a href="/swat/help/NT_Security.html">UNIX ンzin Bitleri ve Samba 2.x</a> - <li><a href="/swat/help/OS2-Client-HOWTO.html">OS/2 ンstemcileri ve Samba</a> - <li><a href="/swat/help/printer_driver2.html">Samba 2.2.x Altnda Yazc Kullanm</a> - <li><a href="/swat/help/UNIX_INSTALL.html">Samba Nasl Kurulur ve Kontrol Edilir?</a> - <li><a href="/swat/help/Integrating-with-Windows.html">ンsim ヌznme ve Yetkilendirme ンlemlerini Birletirmek</a> - <li><a href="/swat/help/CVS-Access.html">Samba yazlmlarna CVS Eriimi</a> + <li><a href="/swat/help/winbind.html">Winbind Kullanarak Windows NT ve UNIX Arasトアnda Birleナ殃k Sistem Giriナ殃</a> + <li><a href="/swat/help/msdfs_setup.html">Samba'yトア bir MS-DFS Sunucusu Olarak Ayarlamak</a> + <li><a href="/swat/help/NT_Security.html">UNIX トーzin Bitleri ve Samba 2.x</a> + <li><a href="/swat/help/OS2-Client-HOWTO.html">OS/2 トーstemcileri ve Samba</a> + <li><a href="/swat/help/printer_driver2.html">Samba 2.2.x Altトアnda Yazトアcトア Kullanトアmトア</a> + <li><a href="/swat/help/UNIX_INSTALL.html">Samba Nasトアl Kurulur ve Kontrol Edilir?</a> + <li><a href="/swat/help/Integrating-with-Windows.html">トーsim テテカzテシnme ve Yetkilendirme トーナ殕emlerini Birleナ殳irmek</a> + <li><a href="/swat/help/CVS-Access.html">Samba yazトアlトアmlarトアna CVS Eriナ殃mi</a> </ul> </ul> - <h3>ンletiim</h3> + <h3>トーletiナ殃m</h3> - Eer SWAT'n bu srm ile ilgili konular tartmak istiyorsanz, ltfen -<A HREF="http://lists.samba.org/">samba</A> eposta listesine ye olun. + Eト歹r SWAT'トアn bu sテシrテシmテシ ile ilgili konularトア tartトアナ殞ak istiyorsanトアz, lテシtfen +<A HREF="http://lists.samba.org/">samba</A> eposta listesine テシye olun.
\ No newline at end of file diff --git a/swat/lang/tr/include/header.html b/swat/lang/tr/include/header.html deleted file mode 100644 index 7c11fd0ef9f..00000000000 --- a/swat/lang/tr/include/header.html +++ /dev/null @@ -1,10 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> -<HTML> -<HEAD> -<TITLE>Samba Web Ynetim Arac</TITLE> -</HEAD> -<BODY bgcolor="white"> -<CENTER> -<IMG SRC="/swat/images/samba.gif" ALT="[ Samba ]" border=0><BR> -<TABLE WIDTH="98%" CELLSPACING=1 CELLPADDING=4 BORDER=1> -<TR><TD BGCOLOR="#ddddd0"> |