# This patch file was generated by NetBeans IDE
# Following Index: paths are relative to: C:\xampp\htdocs\wordtrunk\wp-includes
# This patch can be applied using context Tools: Patch action on respective folder.
# It uses platform neutral UTF-8 encoding and \n newlines.
# Above lines and this line are ignored by the patching process.
Index: class-wp-xmlrpc-server.php
--- class-wp-xmlrpc-server.php Base (BASE)
+++ class-wp-xmlrpc-server.php Locally Modified (Based On LOCAL)
@@ -621,8 +621,39 @@
 		if( ! ( (bool) $post_type ) )
 			return new IXR_Error( 403, __( 'Invalid post type' ) );
 
+                $update = false;
+                if ( !empty( $post_data['ID'] ) )
+                        $update = true;
+                if( $update ) {
+
+                        if( ! current_user_can( $post_type->cap->edit_post, $post_data['ID'] ) )
+                                return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post.' ) );
+
+                        switch ( $post_data['post_status'] ) {
+                                case 'draft':
+                                case 'pending':
+                                        break;
+                                case 'private':
+                                        if( ! current_user_can( $post_type->cap->publish_post, $post_data['ID'] ) )
+                                                return new IXR_Error( 401, __( 'Sorry, you are not allowed set this post as private.' ));
+                                        break;
+                                case 'publish':
+                                case 'future':
+                                        if( ! current_user_can( $post_type->cap->publish_post, $post_data['ID'] ) )
+                                                return new IXR_Error( 401, __( 'Sorry, you are not allowed to publish this post.' ));
+                                        break;
+                                default:
+                                        $post_data['post_status'] = 'draft';
+                                break;
+                        }
+
+                        if ( ! empty( $post_data['post_password'] ) && ! current_user_can( $post_type->cap->publish_post, $post_data['ID'] ) )
+                                return new IXR_Error( 401, __( 'Sorry, you are not allowed to set password to this post' ) );
+
+                } else {
+
 		if( ! current_user_can( $post_type->cap->edit_posts ) )
-			return new IXR_Error( 401, __( 'Sorry, you are not allowed to post on this site.' ) );
+                                return new IXR_Error( 401, __( 'Sorry, you are not allowed to post in this post type.' ) );
 
 		switch ( $post_data['post_status'] ) {
 			case 'draft':
@@ -645,6 +676,7 @@
 		if ( ! empty( $post_data['post_password'] ) && ! current_user_can( $post_type->cap->publish_posts ) )
 			return new IXR_Error( 401, __( 'Sorry, you are not allowed to create password protected posts in this post type' ) );
 
+                }
 
 		$post_data['post_author'] = absint( $post_data['post_author'] );
 		if( ! empty( $post_data['post_author'] ) && $post_data['post_author'] != $user->ID ) {
