Opened 5 years ago

Closed 5 years ago

#59424 closed defect (duplicate)

openssh @8.1p1_1: error: use of undeclared identifier 'kSecAttrAccessGroup'

Reported by: iefdev (Eric F) Owned by: Ionic (Mihai Moldovan)
Priority: Normal Milestone:
Component: ports Version: 2.6.2
Keywords: lion Cc:
Port: openssh

Description

$ grep ': error: ' /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_net_openssh/openssh/main.log 
:info:build keychain.m:66:15: error: use of undeclared identifier 'kSecAttrAccessGroup'
:info:build keychain.m:124:9: error: use of undeclared identifier 'kSecAttrAccessGroup'
:info:build keychain.m:127:60: error: unexpected type name 'BOOL': expected expression
:info:build keychain.m:191:15: error: use of undeclared identifier 'kSecAttrAccessGroup'
:info:build keychain.m:216:9: error: use of undeclared identifier 'kSecAttrAccessGroup'
:info:build keychain.m:230:29: error: expected method to read dictionary element not found on object of type 'NSDictionary *'
:info:build keychain.m:124:9: error: use of undeclared identifier 'kSecAttrAccessGroup'
:info:build                                 (id)kSecAttrAccessGroup: @"com.apple.ssh.passphrases"};
:info:build                                     ^
:info:build keychain.m:127:60: error: unexpected type name 'BOOL': expected expression
:info:build         NSMutableDictionary *searchQuery = [@{(id)kSecReturnRef: @YES} mutableCopy];

Attachments (2)

openssh_main.log (338.5 KB) - added by iEFdev 5 years ago.
0002-Apple-keychain-integration-other-changes.patch (39.1 KB) - added by iEFdev 5 years ago.

Download all attachments as: .zip

Change History (7)

Changed 5 years ago by iEFdev

Attachment: openssh_main.log added

comment:1 Changed 5 years ago by iEFdev

kSecAttrAccessGroup is 10.9+

Tried to wrap it with:

#if ((defined (MAC_OS_X_VERSION_10_9)) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_9))
			       (id)kSecAttrAccessGroup: @"com.apple.ssh.passphrases",
#endif /* ((defined (MAC_OS_X_VERSION_10_9)) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_9)) */

// ... //

#if ((defined (MAC_OS_X_VERSION_10_9)) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_9))
				(id)kSecAttrAccessGroup: @"com.apple.ssh.passphrases"};
#endif /* ((defined (MAC_OS_X_VERSION_10_9)) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_9)) */

// ... //

#if ((defined (MAC_OS_X_VERSION_10_9)) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_9))
			       (id)kSecAttrAccessGroup: @"com.apple.ssh.passphrases"};
#endif /* ((defined (MAC_OS_X_VERSION_10_9)) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_9)) */

// ... //

#if ((defined (MAC_OS_X_VERSION_10_9)) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_9))
				(id)kSecAttrAccessGroup: @"com.apple.ssh.passphrases",
#endif /* ((defined (MAC_OS_X_VERSION_10_9)) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_9)) */

But, the it complains about kSecReturnAttributes (10.6+) being a bool:

:info:build keychain.m:94:32: error: unexpected type name 'BOOL': expected expression
:info:build                                (id)kSecReturnData: @YES};

Adding the patch I used with those changes

comment:2 Changed 5 years ago by Ionic (Mihai Moldovan)

Owner: set to Ionic
Status: newaccepted

comment:3 Changed 5 years ago by Mihai Moldovan <ionic@…>

Resolution: fixed
Status: acceptedclosed

In d6e05adab97e8e64939011a7885de3ecf4a55b69/macports-ports (master):

net/openssh: (hopefully) fix build failures on 10.6-. Round four.

Security/Security.h pulls Security/SecItem.h in on 10.7+, but not so on
older platforms, so import that header manually.

kSecAttrAccessGroup is private data up until 10.8, hence we'll need to
include it in our SecItemPriv.h shim.

kSecClassGenericPassword likewise is a private data up until 10.7, so
also add it to the shim.

No revbump since this only fixes build failures.

Fixes: #59397
Fixes: #59424

comment:4 Changed 5 years ago by iEFdev

Resolution: fixed
Status: closedreopened

Thanks! One step ahead. Now there are a few errors on type and method.

:info:build keychain.m:100:32: error: unexpected type name 'BOOL': expected expression
:info:build                                (id)kSecReturnData: @YES};
:info:build                                                     ^
:info:build /usr/include/objc/objc.h:50:26: note: expanded from macro 'YES'
:info:build #define YES             (BOOL)1
:info:build                          ^
:info:build /usr/bin/clang -pipe -Os -fPIE -arch x86_64 -pipe -Wunknown-warning-option -Qunused-arguments -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -fno-strict-aliasing -mretpoline -D_FORTIFY_SOURCE=2 -ftrapv -fno-builtin-memset -fstack-protector-strong -fPIE   -I. -I. -I/opt/local/include -I/opt/local/include -I/opt/local/include -DBROKEN_STRNVIS=1 -D__APPLE_SANDBOX_NAMED_EXTERNAL__ -D__APPLE_API_STRICT_CONFORMANCE -I/opt/local/include/editline -I/opt/local/include -I/opt/local/include -D__APPLE_KEYCHAIN__ -D__APPLE_MEMBERSHIP__ -D__APPLE_TMPDIR__ -D__APPLE_LAUNCHD__ -DSSHDIR=\"/opt/local/etc/ssh\" -D_PATH_SSH_PROGRAM=\"/opt/local/bin/ssh\" -D_PATH_SSH_ASKPASS_DEFAULT=\"/opt/local/libexec/ssh-askpass\" -D_PATH_SFTP_SERVER=\"/opt/local/libexec/sftp-server\" -D_PATH_SSH_KEY_SIGN=\"/opt/local/libexec/ssh-keysign\" -D_PATH_SSH_PKCS11_HELPER=\"/opt/local/libexec/ssh-pkcs11-helper\" -D_PATH_SSH_PIDDIR=\"/opt/local/var/run\" -D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty\" -DHAVE_CONFIG_H -c auth-shadow.c -o auth-shadow.o
:info:build keychain.m:160:60: error: unexpected type name 'BOOL': expected expression
:info:build         NSMutableDictionary *searchQuery = [@{(id)kSecReturnRef: @YES} mutableCopy];
:info:build                                                                   ^
:info:build /usr/include/objc/objc.h:50:26: note: expanded from macro 'YES'
:info:build #define YES             (BOOL)1
:info:build                          ^
:info:build keychain.m:250:32: error: unexpected type name 'BOOL': expected expression
:info:build                                 (id)kSecReturnAttributes: @YES,
:info:build                                                            ^
:info:build /usr/include/objc/objc.h:50:26: note: expanded from macro 'YES'
:info:build #define YES             (BOOL)1
:info:build                          ^
:info:build keychain.m:263:29: error: expected method to read dictionary element not found on object of type 'NSDictionary *'
:info:build                 NSString        *accountString = itemAttributes[(id)kSecAttrAccount];
:info:build                                                  ^
:info:build 4 errors generated.

Turning the 3 @YES into @"YES", and also stringify the "itemAttributes[(id)kSecAttrAccount]"

I don't know if that's correct, but it didn't return any new errors, and it finished the port build openssh. Tried ssh-add --help (in the work directory) and the keychain popped up and asked if it could use a new key I added yesterday. So the connection seems to be there.

comment:5 Changed 5 years ago by Ionic (Mihai Moldovan)

Resolution: duplicate
Status: reopenedclosed

Let's continue that in #59397 - it's really the same issue and doesn't make sense to duplicate stuff around. :)

Note: See TracTickets for help on using tickets.